generate_thumbnail: Catch+log any kind of error
This commit is contained in:
parent
ee6ac18671
commit
d0a19852b7
|
@ -22,11 +22,12 @@ from urllib.parse import urlparse
|
||||||
from uuid import UUID, uuid4
|
from uuid import UUID, uuid4
|
||||||
|
|
||||||
import cairosvg
|
import cairosvg
|
||||||
|
from PIL import Image as PILImage
|
||||||
|
from pymediainfo import MediaInfo
|
||||||
|
|
||||||
import nio
|
import nio
|
||||||
from nio.crypto import AsyncDataT as UploadData
|
from nio.crypto import AsyncDataT as UploadData
|
||||||
from nio.crypto import async_generator_from_data
|
from nio.crypto import async_generator_from_data
|
||||||
from PIL import Image as PILImage
|
|
||||||
from pymediainfo import MediaInfo
|
|
||||||
|
|
||||||
from . import __app_name__, __display_name__, utils
|
from . import __app_name__, __display_name__, utils
|
||||||
from .errors import (
|
from .errors import (
|
||||||
|
@ -463,8 +464,9 @@ class MatrixClient(nio.AsyncClient):
|
||||||
)
|
)
|
||||||
except UneededThumbnail:
|
except UneededThumbnail:
|
||||||
pass
|
pass
|
||||||
except OSError as err:
|
except Exception:
|
||||||
log.warning(f"Failed thumbnailing {path}: {err}")
|
trace = traceback.format_exc().rstrip()
|
||||||
|
log.warning("Failed thumbnailing %s:\n%s", path, trace)
|
||||||
else:
|
else:
|
||||||
thumb_ext = "png" if thumb_info.mime == "image/png" else "jpg"
|
thumb_ext = "png" if thumb_info.mime == "image/png" else "jpg"
|
||||||
thumb_name = f"{path.stem}_thumbnail.{thumb_ext}"
|
thumb_name = f"{path.stem}_thumbnail.{thumb_ext}"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user