From d307b6c015b8c3ac422b126341f0c8162f96732c Mon Sep 17 00:00:00 2001 From: Paul Friederichsen Date: Wed, 2 Aug 2023 06:57:31 -0500 Subject: [PATCH] Use ffmpeg for metadata and thumbnails for HEIC and HEIF sequences PIL could give us thumbs for HEIF and HEIC sequences but since we are using ffmpeg for their metadata, using ffmpeg for their thumbs will be more consistent. --- hydrus/core/HydrusFileHandling.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hydrus/core/HydrusFileHandling.py b/hydrus/core/HydrusFileHandling.py index 6924b0c2..ec12f663 100644 --- a/hydrus/core/HydrusFileHandling.py +++ b/hydrus/core/HydrusFileHandling.py @@ -93,7 +93,7 @@ headers_and_mime.extend( [ ( ( ( 4, b'ftyphevm' ), ), HC.IMAGE_HEIC_SEQUENCE ), ( ( ( 4, b'ftyphevs' ), ), HC.IMAGE_HEIC_SEQUENCE ), ( ( ( 4, b'ftypmif1' ), ), HC.IMAGE_HEIF ), - ( ( ( 4, b'ftypsf1' ), ), HC.IMAGE_HEIF_SEQUENCE ), + ( ( ( 4, b'ftypmsf1' ), ), HC.IMAGE_HEIF_SEQUENCE ), ( ( ( 4, b'ftypmp4' ), ), HC.UNDETERMINED_MP4 ), ( ( ( 4, b'ftypisom' ), ), HC.UNDETERMINED_MP4 ), ( ( ( 4, b'ftypM4V' ), ), HC.UNDETERMINED_MP4 ), @@ -117,7 +117,7 @@ def GenerateThumbnailBytes( path, target_resolution, mime, duration, num_frames, target_resolution = ( 128, 128 ) - if mime in { HC.IMAGE_JPEG, HC.IMAGE_PNG, HC.IMAGE_GIF, HC.IMAGE_WEBP, HC.IMAGE_TIFF, HC.IMAGE_ICON }.union( HC.PIL_HEIF_MIMES ): # not apng atm + if mime in ( HC.IMAGE_JPEG, HC.IMAGE_PNG, HC.IMAGE_GIF, HC.IMAGE_WEBP, HC.IMAGE_TIFF, HC.IMAGE_ICON, HC.IMAGE_HEIF, HC.IMAGE_HEIC, HC.IMAGE_AVIF ): # not apng atm try: @@ -368,7 +368,7 @@ def GetFileInfo( path, mime = None, ok_to_look_for_hydrus_updates = False ): has_audio = False - if mime in { HC.IMAGE_JPEG, HC.IMAGE_PNG, HC.IMAGE_GIF, HC.IMAGE_WEBP, HC.IMAGE_TIFF, HC.IMAGE_ICON }.union( HC.PIL_HEIF_MIMES ): + if mime in ( HC.IMAGE_JPEG, HC.IMAGE_PNG, HC.IMAGE_GIF, HC.IMAGE_WEBP, HC.IMAGE_TIFF, HC.IMAGE_ICON, HC.IMAGE_HEIF, HC.IMAGE_HEIC, HC.IMAGE_AVIF ): ( ( width, height ), duration, num_frames ) = HydrusImageHandling.GetImageProperties( path, mime ) @@ -400,7 +400,7 @@ def GetFileInfo( path, mime = None, ok_to_look_for_hydrus_updates = False ): ( width, height ) = HydrusImageHandling.GetPSDResolution( path ) - elif mime in HC.VIDEO or mime == HC.IMAGE_AVIF_SEQUENCE: + elif mime in HC.VIDEO.union( { HC.IMAGE_HEIF_SEQUENCE, HC.IMAGE_HEIC_SEQUENCE, HC.IMAGE_AVIF_SEQUENCE }): ( ( width, height ), duration, num_frames, has_audio ) = HydrusVideoHandling.GetFFMPEGVideoProperties( path )