diff --git a/hydrus/client/db/ClientDBFilesSearch.py b/hydrus/client/db/ClientDBFilesSearch.py index 0796faf6..6d42caa4 100644 --- a/hydrus/client/db/ClientDBFilesSearch.py +++ b/hydrus/client/db/ClientDBFilesSearch.py @@ -2445,6 +2445,12 @@ class ClientDBFilesQuery( ClientDBModule.ClientDBModule ): if sort_data == CC.SORT_FILES_BY_IMPORT_TIME: + def deal_with_none( x ): + + if x is None: return -1 + else: return x + + def key( row ): hash_id = row[0] @@ -2452,7 +2458,7 @@ class ClientDBFilesQuery( ClientDBModule.ClientDBModule ): # hash_id to differentiate files imported in the same second - return ( timestamp, hash_id ) + return ( deal_with_none( timestamp ), hash_id ) elif sort_data == CC.SORT_FILES_BY_RATIO: diff --git a/hydrus/core/HydrusConstants.py b/hydrus/core/HydrusConstants.py index 865d757b..d530c085 100644 --- a/hydrus/core/HydrusConstants.py +++ b/hydrus/core/HydrusConstants.py @@ -764,7 +764,7 @@ MIMES_WITH_THUMBNAILS = set( IMAGES ).union( ANIMATIONS ).union( VIDEO ).union( FILES_THAT_CAN_HAVE_ICC_PROFILE = { IMAGE_JPEG, IMAGE_PNG, IMAGE_GIF, IMAGE_TIFF } -FILES_THAT_CAN_HAVE_EXIF = { IMAGE_JPEG, IMAGE_TIFF } +FILES_THAT_CAN_HAVE_EXIF = { IMAGE_JPEG, IMAGE_TIFF, IMAGE_PNG } # images and animations that PIL can handle FILES_THAT_CAN_HAVE_HUMAN_READABLE_EMBEDDED_METADATA = { IMAGE_JPEG, IMAGE_PNG, IMAGE_BMP, IMAGE_WEBP, IMAGE_TIFF, IMAGE_ICON, IMAGE_GIF, IMAGE_APNG } diff --git a/hydrus/core/HydrusImageHandling.py b/hydrus/core/HydrusImageHandling.py index 0964477b..627615b1 100644 --- a/hydrus/core/HydrusImageHandling.py +++ b/hydrus/core/HydrusImageHandling.py @@ -529,7 +529,7 @@ def GenerateThumbnailBytesPIL( pil_image: PILImage.Image ) -> bytes: def GetEXIFDict( pil_image: PILImage.Image ) -> typing.Optional[ dict ]: - if pil_image.format in ( 'JPEG', 'TIFF' ) and hasattr( pil_image, '_getexif' ): + if pil_image.format in ( 'JPEG', 'TIFF', 'PNG' ) and hasattr( pil_image, '_getexif' ): try: