Updates to path, path_raw, uti for RAW+JPEG pairs
This commit is contained in:
@@ -68,11 +68,9 @@ class PhotoInfo:
|
|||||||
@property
|
@property
|
||||||
def filename(self):
|
def filename(self):
|
||||||
""" filename of the picture """
|
""" filename of the picture """
|
||||||
# sourcery off
|
if self._db._db_version <= _PHOTOS_4_VERSION and self.has_raw and self.raw_original:
|
||||||
if self.has_raw and self.raw_original:
|
# return the JPEG version as that's what Photos 5+ does
|
||||||
# return name of the RAW file
|
return self._info["raw_pair_info"]["filename"]
|
||||||
# TODO: not yet implemented
|
|
||||||
return self._info["filename"]
|
|
||||||
else:
|
else:
|
||||||
return self._info["filename"]
|
return self._info["filename"]
|
||||||
|
|
||||||
@@ -80,6 +78,10 @@ class PhotoInfo:
|
|||||||
def original_filename(self):
|
def original_filename(self):
|
||||||
""" original filename of the picture
|
""" original filename of the picture
|
||||||
Photos 5 mangles filenames upon import """
|
Photos 5 mangles filenames upon import """
|
||||||
|
if self._db._db_version <= _PHOTOS_4_VERSION and self.has_raw and self.raw_original:
|
||||||
|
# return the JPEG version as that's what Photos 5+ does
|
||||||
|
return self._info["raw_pair_info"]["originalFilename"]
|
||||||
|
else:
|
||||||
return self._info["originalFilename"]
|
return self._info["originalFilename"]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -117,9 +119,28 @@ class PhotoInfo:
|
|||||||
return photopath # path would be meaningless until downloaded
|
return photopath # path would be meaningless until downloaded
|
||||||
|
|
||||||
if self._db._db_version <= _PHOTOS_4_VERSION:
|
if self._db._db_version <= _PHOTOS_4_VERSION:
|
||||||
|
if self._info["has_raw"]:
|
||||||
|
# return the path to JPEG even if RAW is original
|
||||||
|
vol = (
|
||||||
|
self._db._dbvolumes[self._info["raw_pair_info"]["volumeId"]]
|
||||||
|
if self._info["raw_pair_info"]["volumeId"] is not None
|
||||||
|
else None
|
||||||
|
)
|
||||||
|
if vol is not None:
|
||||||
|
photopath = os.path.join(
|
||||||
|
"/Volumes", vol, self._info["raw_pair_info"]["imagePath"]
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
photopath = os.path.join(
|
||||||
|
self._db._masters_path,
|
||||||
|
self._info["raw_pair_info"]["imagePath"],
|
||||||
|
)
|
||||||
|
else:
|
||||||
vol = self._info["volume"]
|
vol = self._info["volume"]
|
||||||
if vol is not None:
|
if vol is not None:
|
||||||
photopath = os.path.join("/Volumes", vol, self._info["imagePath"])
|
photopath = os.path.join(
|
||||||
|
"/Volumes", vol, self._info["imagePath"]
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
photopath = os.path.join(
|
photopath = os.path.join(
|
||||||
self._db._masters_path, self._info["imagePath"]
|
self._db._masters_path, self._info["imagePath"]
|
||||||
@@ -507,9 +528,13 @@ class PhotoInfo:
|
|||||||
for example: public.jpeg or com.apple.quicktime-movie
|
for example: public.jpeg or com.apple.quicktime-movie
|
||||||
"""
|
"""
|
||||||
if self._db._db_version <= _PHOTOS_4_VERSION:
|
if self._db._db_version <= _PHOTOS_4_VERSION:
|
||||||
return (
|
if self.hasadjustments:
|
||||||
self._info["UTI_edited"] if self.hasadjustments else self._info["UTI"]
|
return self._info["UTI_edited"]
|
||||||
)
|
elif self.has_raw and self.raw_original:
|
||||||
|
# return UTI of the non-raw image to match Photos 5+ behavior
|
||||||
|
return self._info["raw_pair_info"]["UTI"]
|
||||||
|
else:
|
||||||
|
return self._info["UTI"]
|
||||||
else:
|
else:
|
||||||
return self._info["UTI"]
|
return self._info["UTI"]
|
||||||
|
|
||||||
|
|||||||
@@ -846,7 +846,8 @@ class PhotosDB:
|
|||||||
RKMaster.height,
|
RKMaster.height,
|
||||||
RKMaster.width,
|
RKMaster.width,
|
||||||
RKMaster.orientation,
|
RKMaster.orientation,
|
||||||
RKMaster.fileSize
|
RKMaster.fileSize,
|
||||||
|
RKVersion.subType
|
||||||
FROM RKVersion, RKMaster
|
FROM RKVersion, RKMaster
|
||||||
WHERE RKVersion.masterUuid = RKMaster.uuid"""
|
WHERE RKVersion.masterUuid = RKMaster.uuid"""
|
||||||
)
|
)
|
||||||
@@ -873,7 +874,8 @@ class PhotosDB:
|
|||||||
RKMaster.height,
|
RKMaster.height,
|
||||||
RKMaster.width,
|
RKMaster.width,
|
||||||
RKMaster.orientation,
|
RKMaster.orientation,
|
||||||
RKMaster.originalFileSize
|
RKMaster.originalFileSize,
|
||||||
|
RKVersion.subType
|
||||||
FROM RKVersion, RKMaster
|
FROM RKVersion, RKMaster
|
||||||
WHERE RKVersion.masterUuid = RKMaster.uuid"""
|
WHERE RKVersion.masterUuid = RKMaster.uuid"""
|
||||||
)
|
)
|
||||||
@@ -919,6 +921,7 @@ class PhotosDB:
|
|||||||
# 37 RKMaster.width,
|
# 37 RKMaster.width,
|
||||||
# 38 RKMaster.orientation,
|
# 38 RKMaster.orientation,
|
||||||
# 39 RKMaster.originalFileSize
|
# 39 RKMaster.originalFileSize
|
||||||
|
# 40 RKVersion.subType
|
||||||
|
|
||||||
for row in c:
|
for row in c:
|
||||||
uuid = row[0]
|
uuid = row[0]
|
||||||
@@ -1062,10 +1065,20 @@ class PhotosDB:
|
|||||||
self._dbphotos[uuid]["cloudAvailable"] = None
|
self._dbphotos[uuid]["cloudAvailable"] = None
|
||||||
self._dbphotos[uuid]["incloud"] = None
|
self._dbphotos[uuid]["incloud"] = None
|
||||||
|
|
||||||
# TODO: NOT YET USED -- PLACEHOLDER for RAW processing (currently only in _process_database5)
|
|
||||||
# original resource choice (e.g. RAW or jpeg)
|
# original resource choice (e.g. RAW or jpeg)
|
||||||
self._dbphotos[uuid]["original_resource_choice"] = None
|
# In Photos 5+, original_resource_choice set from:
|
||||||
self._dbphotos[uuid]["raw_is_original"] = None
|
# ZADDITIONALASSETATTRIBUTES.ZORIGINALRESOURCECHOICE
|
||||||
|
# = 0 if jpeg is selected as "original" in Photos (the default)
|
||||||
|
# = 1 if RAW is selected as "original" in Photos
|
||||||
|
# RKVersion.subType, RAW always appears to be 16
|
||||||
|
# 4 = mov
|
||||||
|
# 16 = RAW
|
||||||
|
# 32 = JPEG
|
||||||
|
# 64 = TIFF
|
||||||
|
# 2048 = PNG
|
||||||
|
# 32768 = HIEC
|
||||||
|
self._dbphotos[uuid]["original_resource_choice"] = 1 if row[40] == 16 else 0
|
||||||
|
self._dbphotos[uuid]["raw_is_original"] = True if row[40] == 16 else False
|
||||||
|
|
||||||
# associated RAW image info
|
# associated RAW image info
|
||||||
self._dbphotos[uuid]["has_raw"] = True if row[25] == 7 else False
|
self._dbphotos[uuid]["has_raw"] = True if row[25] == 7 else False
|
||||||
@@ -1107,7 +1120,8 @@ class PhotosDB:
|
|||||||
RKMaster.modelID,
|
RKMaster.modelID,
|
||||||
RKMaster.fileSize,
|
RKMaster.fileSize,
|
||||||
RKMaster.isTrulyRaw,
|
RKMaster.isTrulyRaw,
|
||||||
RKMaster.alternateMasterUuid
|
RKMaster.alternateMasterUuid,
|
||||||
|
RKMaster.filename
|
||||||
FROM RKMaster
|
FROM RKMaster
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
@@ -1123,6 +1137,7 @@ class PhotosDB:
|
|||||||
# 7 RKMaster.fileSize,
|
# 7 RKMaster.fileSize,
|
||||||
# 8 RKMaster.isTrulyRaw,
|
# 8 RKMaster.isTrulyRaw,
|
||||||
# 9 RKMaster.alternateMasterUuid
|
# 9 RKMaster.alternateMasterUuid
|
||||||
|
# 10 RKMaster.filename
|
||||||
|
|
||||||
for row in c:
|
for row in c:
|
||||||
uuid = row[0]
|
uuid = row[0]
|
||||||
@@ -1137,6 +1152,7 @@ class PhotosDB:
|
|||||||
info["fileSize"] = row[7]
|
info["fileSize"] = row[7]
|
||||||
info["isTrulyRAW"] = row[8]
|
info["isTrulyRAW"] = row[8]
|
||||||
info["alternateMasterUuid"] = row[9]
|
info["alternateMasterUuid"] = row[9]
|
||||||
|
info["filename"] = row[10]
|
||||||
self._dbphotos_master[uuid] = info
|
self._dbphotos_master[uuid] = info
|
||||||
|
|
||||||
# get details needed to find path of the edited photos
|
# get details needed to find path of the edited photos
|
||||||
@@ -1336,6 +1352,12 @@ class PhotosDB:
|
|||||||
raw_uuid = info["raw_master_uuid"]
|
raw_uuid = info["raw_master_uuid"]
|
||||||
info["raw_info"] = self._dbphotos_master[raw_uuid]
|
info["raw_info"] = self._dbphotos_master[raw_uuid]
|
||||||
info["UTI_raw"] = self._dbphotos_master[raw_uuid]["UTI"]
|
info["UTI_raw"] = self._dbphotos_master[raw_uuid]["UTI"]
|
||||||
|
non_raw_uuid = info["non_raw_master_uuid"]
|
||||||
|
info["raw_pair_info"] = self._dbphotos_master[non_raw_uuid]
|
||||||
|
else:
|
||||||
|
info["raw_info"] = None
|
||||||
|
info["UTI_raw"] = None
|
||||||
|
info["raw_pair_info"] = None
|
||||||
|
|
||||||
# done with the database connection
|
# done with the database connection
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -3,8 +3,8 @@
|
|||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
<key>PhotoAnalysisGraphLastBackgroundGraphRebuildJobDate</key>
|
<key>PhotoAnalysisGraphLastBackgroundGraphRebuildJobDate</key>
|
||||||
<date>2020-10-04T23:43:21Z</date>
|
<date>2020-10-09T16:14:42Z</date>
|
||||||
<key>PhotoAnalysisGraphLastBackgroundMemoryGenerationJobDate</key>
|
<key>PhotoAnalysisGraphLastBackgroundMemoryGenerationJobDate</key>
|
||||||
<date>2020-10-05T04:14:45Z</date>
|
<date>2020-10-09T19:48:34Z</date>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -3,7 +3,7 @@
|
|||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
<key>LastHistoryRowId</key>
|
<key>LastHistoryRowId</key>
|
||||||
<integer>947</integer>
|
<integer>948</integer>
|
||||||
<key>LibraryBuildTag</key>
|
<key>LibraryBuildTag</key>
|
||||||
<string>D8C4AAA1-3AB6-4A65-BEBD-99CC3E5D433E</string>
|
<string>D8C4AAA1-3AB6-4A65-BEBD-99CC3E5D433E</string>
|
||||||
<key>LibrarySchemaVersion</key>
|
<key>LibrarySchemaVersion</key>
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
<key>HistoricalMarker</key>
|
<key>HistoricalMarker</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>LastHistoryRowId</key>
|
<key>LastHistoryRowId</key>
|
||||||
<integer>947</integer>
|
<integer>948</integer>
|
||||||
<key>LibraryBuildTag</key>
|
<key>LibraryBuildTag</key>
|
||||||
<string>D8C4AAA1-3AB6-4A65-BEBD-99CC3E5D433E</string>
|
<string>D8C4AAA1-3AB6-4A65-BEBD-99CC3E5D433E</string>
|
||||||
<key>LibrarySchemaVersion</key>
|
<key>LibrarySchemaVersion</key>
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
<key>SnapshotCompletedDate</key>
|
<key>SnapshotCompletedDate</key>
|
||||||
<date>2019-07-27T13:16:43Z</date>
|
<date>2019-07-27T13:16:43Z</date>
|
||||||
<key>SnapshotLastValidated</key>
|
<key>SnapshotLastValidated</key>
|
||||||
<date>2020-10-04T23:49:39Z</date>
|
<date>2020-10-09T16:16:27Z</date>
|
||||||
<key>SnapshotTables</key>
|
<key>SnapshotTables</key>
|
||||||
<dict/>
|
<dict/>
|
||||||
</dict>
|
</dict>
|
||||||
|
|||||||
Binary file not shown.
@@ -76,7 +76,7 @@ UUID_UTI_DICT = {
|
|||||||
None,
|
None,
|
||||||
],
|
],
|
||||||
"oTiMG6OfSP6d%nUTEOfvMg": [
|
"oTiMG6OfSP6d%nUTEOfvMg": [
|
||||||
"com.canon.cr2-raw-image",
|
"public.jpeg",
|
||||||
"com.canon.cr2-raw-image",
|
"com.canon.cr2-raw-image",
|
||||||
"com.canon.cr2-raw-image",
|
"com.canon.cr2-raw-image",
|
||||||
None,
|
None,
|
||||||
|
|||||||
Reference in New Issue
Block a user