mirror of
https://github.com/k4yt3x/video2x.git
synced 2025-01-30 23:58:11 +00:00
upscaler 4.4.1: use mimetypes to re-check python-magic's results
This commit is contained in:
parent
43dbb134b6
commit
65d445c293
@ -4,7 +4,7 @@
|
|||||||
Name: Video2X Upscaler
|
Name: Video2X Upscaler
|
||||||
Author: K4YT3X
|
Author: K4YT3X
|
||||||
Date Created: December 10, 2018
|
Date Created: December 10, 2018
|
||||||
Last Modified: September 13, 2020
|
Last Modified: October 26, 2020
|
||||||
|
|
||||||
Description: This file contains the Upscaler class. Each
|
Description: This file contains the Upscaler class. Each
|
||||||
instance of the Upscaler class is an upscaler on an image or
|
instance of the Upscaler class is an upscaler on an image or
|
||||||
@ -53,7 +53,7 @@ language.install()
|
|||||||
_ = language.gettext
|
_ = language.gettext
|
||||||
|
|
||||||
# version information
|
# version information
|
||||||
UPSCALER_VERSION = '4.4.0'
|
UPSCALER_VERSION = '4.4.1'
|
||||||
|
|
||||||
# these names are consistent for
|
# these names are consistent for
|
||||||
# - driver selection in command line
|
# - driver selection in command line
|
||||||
@ -474,7 +474,11 @@ class Upscaler:
|
|||||||
input_file_type = input_file_mime_type.split('/')[0]
|
input_file_type = input_file_mime_type.split('/')[0]
|
||||||
input_file_subtype = input_file_mime_type.split('/')[1]
|
input_file_subtype = input_file_mime_type.split('/')[1]
|
||||||
except Exception:
|
except Exception:
|
||||||
|
input_file_mime_type = input_file_type = input_file_subtype = ''
|
||||||
|
|
||||||
|
# if python-magic doesn't determine the file to be an image/video file
|
||||||
|
# fall back to mimetypes to guess the file type based on the extension
|
||||||
|
if input_file_type not in ['image', 'video']:
|
||||||
# in case python-magic fails to detect file type
|
# in case python-magic fails to detect file type
|
||||||
# try guessing file mime type with mimetypes
|
# try guessing file mime type with mimetypes
|
||||||
input_file_mime_type = mimetypes.guess_type(input_path.name)[0]
|
input_file_mime_type = mimetypes.guess_type(input_path.name)[0]
|
||||||
|
Loading…
Reference in New Issue
Block a user