artresizer: add FIXME notes where we should probably add some warnings

There's a lot of places where ArtResizer fails or falls back to
completely silently. We should at least log this, or maybe even raise
exceptions in some cases so that the caller can take a decision on how
to handle the failure.
This commit is contained in:
wisp3rwind 2022-03-12 20:59:25 +01:00
parent bc364bc7d4
commit f751893be2

View file

@ -207,7 +207,7 @@ class IMBackend(LocalBackend):
util.command_output(cmd) util.command_output(cmd)
return path_out return path_out
except subprocess.CalledProcessError: except subprocess.CalledProcessError:
# FIXME: add a warning # FIXME: Should probably issue a warning?
return path_in return path_in
def get_format(self, filepath): def get_format(self, filepath):
@ -219,6 +219,7 @@ class IMBackend(LocalBackend):
try: try:
return util.command_output(cmd).stdout return util.command_output(cmd).stdout
except subprocess.CalledProcessError: except subprocess.CalledProcessError:
# FIXME: Should probably issue a warning?
return None return None
def convert_format(self, source, target, deinterlaced): def convert_format(self, source, target, deinterlaced):
@ -236,6 +237,7 @@ class IMBackend(LocalBackend):
) )
return target return target
except subprocess.CalledProcessError: except subprocess.CalledProcessError:
# FIXME: Should probably issue a warning?
return source return source
@property @property
@ -404,6 +406,7 @@ class PILBackend(LocalBackend):
im.save(py3_path(path_out), progressive=False) im.save(py3_path(path_out), progressive=False)
return path_out return path_out
except IOError: except IOError:
# FIXME: Should probably issue a warning?
return path_in return path_in
def get_format(self, filepath): def get_format(self, filepath):
@ -574,6 +577,9 @@ class ArtResizer(metaclass=Shareable):
result_path = self.local_method.convert_format( result_path = self.local_method.convert_format(
path_in, path_new, deinterlaced path_in, path_new, deinterlaced
) )
except Exception:
# FIXME: Should probably issue a warning?
pass
finally: finally:
if result_path != path_in: if result_path != path_in:
os.unlink(path_in) os.unlink(path_in)