mirror of
https://git.lecygnenoir.info/LecygneNoir/prismedia.git
synced 2025-10-03 17:39:16 +02:00
Empower user to force using the file they selected
At least on Windows I got multiples times a detected type of `inode/blockdevice`. In reality files where good mp4 files accepted by peertube and youtube.
This commit is contained in:
parent
a1c472a5fa
commit
802d70b8d5
1 changed files with 10 additions and 4 deletions
|
@ -115,11 +115,17 @@ VALID_LANGUAGES = ('arabic', 'english', 'french',
|
|||
|
||||
def validateVideo(path):
|
||||
supported_types = ['video/mp4']
|
||||
if magic.from_file(path, mime=True) in supported_types:
|
||||
return path
|
||||
else:
|
||||
detected_type = magic.from_file(path, mime=True)
|
||||
if detected_type not in supported_types:
|
||||
print("File", path, "detected type is", detected_type, "which is not one of", supported_types)
|
||||
|
||||
force_file = ['y', 'yes']
|
||||
is_forcing = input("Are you sure you selected the correct file? (y/N)")
|
||||
if is_forcing.lower() not in force_file:
|
||||
return False
|
||||
|
||||
return path
|
||||
|
||||
|
||||
def validateCategory(category):
|
||||
if category.lower() in VALID_CATEGORIES:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue