PNG EXIF and deleted file import time sort

This commit is contained in:
Hydrus Network Developer 2023-07-01 14:16:50 -05:00
parent 623e6999a6
commit c4bf014bde
No known key found for this signature in database
GPG Key ID: 76249F053212133C
3 changed files with 9 additions and 3 deletions

View File

@ -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:

View File

@ -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 }

View File

@ -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: