Added PhotoInfo.fingerprint #900 (#901)

This commit is contained in:
Rhet Turnbull
2023-01-06 18:39:12 -08:00
committed by GitHub
parent 1f7480a9b9
commit 6788f318a2
8 changed files with 138 additions and 67 deletions

View File

@@ -1451,6 +1451,11 @@ class PhotoInfo:
metadata = plistlib.loads(results[0])
return metadata
@cached_property
def fingerprint(self) -> str:
"""Returns fingerprint of original photo as a string"""
return self._info["masterFingerprint"]
def detected_text(self, confidence_threshold=TEXT_DETECTION_CONFIDENCE_THRESHOLD):
"""Detects text in photo and returns lists of results as (detected text, confidence)

View File

@@ -953,7 +953,8 @@ class PhotosDB:
RKVersion.inTrashDate,
RKVersion.showInLibrary,
RKMaster.fileIsReference,
RKMaster.importGroupUuid
RKMaster.importGroupUuid,
RKMaster.fingerprint
FROM RKVersion, RKMaster
WHERE RKVersion.masterUuid = RKMaster.uuid"""
)
@@ -985,7 +986,8 @@ class PhotosDB:
RKVersion.inTrashDate,
RKVersion.showInLibrary,
RKMaster.fileIsReference,
RKMaster.importGroupUuid
RKMaster.importGroupUuid,
RKMaster.fingerprint
FROM RKVersion, RKMaster
WHERE RKVersion.masterUuid = RKMaster.uuid"""
)
@@ -1036,6 +1038,7 @@ class PhotosDB:
# 42 RKVersion.showInLibrary -- is item visible in library (e.g. non-selected burst images are not visible)
# 43 RKMaster.fileIsReference -- file is reference (imported without copying to Photos library)
# 44 RKMaster.importGroupUuid -- to get date added from RKImportGroup
# 45 RKMaster.fingerprint -- fingerprint / hash of the file
for row in c:
uuid = row[0]
@@ -1233,6 +1236,9 @@ class PhotosDB:
self._dbphotos[uuid]["import_uuid"] = row[44]
self._dbphotos[uuid]["fok_import_session"] = None
# fingerprint
self._dbphotos[uuid]["masterFingerprint"] = row[45]
# photos 5+ only, for shared photos
self._dbphotos[uuid]["cloudownerhashedpersonid"] = None