Report exiftool errors
Raise an exception when exiftool provides a Warning or Error, which usually indicates a corrupted file. This exception is handled by the allow_broken_uploads setting.
This commit is contained in:
parent
e7ab2fe99f
commit
dadeeb6abd
1 changed files with 10 additions and 1 deletions
|
@ -16,7 +16,6 @@ from szurubooru import errors
|
||||||
from szurubooru.func import mime, util
|
from szurubooru.func import mime, util
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
logger.setLevel(level=logging.INFO)
|
|
||||||
|
|
||||||
# Refer to:
|
# Refer to:
|
||||||
# https://exiftool.org/TagNames/EXIF.html
|
# https://exiftool.org/TagNames/EXIF.html
|
||||||
|
@ -95,6 +94,8 @@ class Image:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def _orientation_filter(self) -> str:
|
def _orientation_filter(self) -> str:
|
||||||
|
# This filter should be omitted in ffmpeg>=6.0,
|
||||||
|
# where it is automatically applied.
|
||||||
try:
|
try:
|
||||||
return ORIENTATION_FILTER[self.info["Orientation"]]
|
return ORIENTATION_FILTER[self.info["Orientation"]]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
@ -390,3 +391,11 @@ class Image:
|
||||||
logger.warning("Unexpected output from exiftool")
|
logger.warning("Unexpected output from exiftool")
|
||||||
|
|
||||||
self.info = exiftool_data[0]
|
self.info = exiftool_data[0]
|
||||||
|
|
||||||
|
if "Error" in self.info:
|
||||||
|
raise errors.ProcessingError(
|
||||||
|
"Error in metadata:" + str(self.info["Error"]))
|
||||||
|
|
||||||
|
if "Warning" in self.info:
|
||||||
|
raise errors.ProcessingError(
|
||||||
|
"Warning in metadata:" + str(self.info["Warning"]))
|
Loading…
Reference in a new issue