Commit
·
2a6a104
1
Parent(s):
ab25f71
fix type checks for mp4 an srt files.
Browse files
main.py
CHANGED
@@ -32,6 +32,13 @@ logging.basicConfig(filename='main.log',
|
|
32 |
|
33 |
class MP4Video(BaseModel):
|
34 |
video_file: UploadFile
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
36 |
@validator('video_file')
|
37 |
def validate_video_file(cls, v):
|
@@ -41,6 +48,16 @@ class MP4Video(BaseModel):
|
|
41 |
|
42 |
class SRTFile(BaseModel):
|
43 |
srt_file: Optional[UploadFile] = None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
@validator('srt_file')
|
46 |
def validate_srt_file(cls, v):
|
|
|
32 |
|
33 |
class MP4Video(BaseModel):
|
34 |
video_file: UploadFile
|
35 |
+
|
36 |
+
@property
|
37 |
+
def filename(self):
|
38 |
+
return self.video_file.filename
|
39 |
+
@property
|
40 |
+
def file(self):
|
41 |
+
return self.video_file.file
|
42 |
|
43 |
@validator('video_file')
|
44 |
def validate_video_file(cls, v):
|
|
|
48 |
|
49 |
class SRTFile(BaseModel):
|
50 |
srt_file: Optional[UploadFile] = None
|
51 |
+
|
52 |
+
@property
|
53 |
+
def filename(self):
|
54 |
+
return self.srt_file.filename
|
55 |
+
@property
|
56 |
+
def file(self):
|
57 |
+
return self.srt_file.file
|
58 |
+
@property
|
59 |
+
def size(self):
|
60 |
+
return self.srt_file.size
|
61 |
|
62 |
@validator('srt_file')
|
63 |
def validate_srt_file(cls, v):
|