Added external_edit for Photos 5
This commit is contained in:
@@ -580,6 +580,7 @@ class PhotosDB:
|
|||||||
self._dbphotos[uuid]["latitude"] = row[18]
|
self._dbphotos[uuid]["latitude"] = row[18]
|
||||||
self._dbphotos[uuid]["longitude"] = row[19]
|
self._dbphotos[uuid]["longitude"] = row[19]
|
||||||
self._dbphotos[uuid]["adjustmentUuid"] = row[20]
|
self._dbphotos[uuid]["adjustmentUuid"] = row[20]
|
||||||
|
self._dbphotos[uuid]["adjustmentFormatID"] = None
|
||||||
|
|
||||||
# get details needed to find path of the edited photos and live photos
|
# get details needed to find path of the edited photos and live photos
|
||||||
c.execute(
|
c.execute(
|
||||||
@@ -598,8 +599,8 @@ class PhotosDB:
|
|||||||
# 3 RKModelResource.resourceTag
|
# 3 RKModelResource.resourceTag
|
||||||
# 4 RKModelResource.UTI
|
# 4 RKModelResource.UTI
|
||||||
# 5 RKVersion.specialType
|
# 5 RKVersion.specialType
|
||||||
# 7 RKModelResource.attachedModelType
|
# 6 RKModelResource.attachedModelType
|
||||||
# 8 RKModelResource.resourceType
|
# 7 RKModelResource.resourceType
|
||||||
|
|
||||||
# TODO: add live photos
|
# TODO: add live photos
|
||||||
# attachedmodeltype is 2, it's a photo, could be more than one
|
# attachedmodeltype is 2, it's a photo, could be more than one
|
||||||
@@ -619,7 +620,7 @@ class PhotosDB:
|
|||||||
if "edit_resource_id" in self._dbphotos[uuid]:
|
if "edit_resource_id" in self._dbphotos[uuid]:
|
||||||
logging.warning(
|
logging.warning(
|
||||||
f"WARNING: found more than one edit_resource_id for "
|
f"WARNING: found more than one edit_resource_id for "
|
||||||
f"UUID {row[0]},adjustmentID {row[1]}, modelID {row[2]}"
|
f"UUID {row[0]},adjustmentUUID {row[1]}, modelID {row[2]}"
|
||||||
)
|
)
|
||||||
# TODO: I think there should never be more than one edit but
|
# TODO: I think there should never be more than one edit but
|
||||||
# I've seen this once in my library
|
# I've seen this once in my library
|
||||||
@@ -892,6 +893,8 @@ class PhotosDB:
|
|||||||
self._dbphotos[uuid]["localAvailability"] = None
|
self._dbphotos[uuid]["localAvailability"] = None
|
||||||
self._dbphotos[uuid]["remoteAvailability"] = None
|
self._dbphotos[uuid]["remoteAvailability"] = None
|
||||||
self._dbphotos[uuid]["isMissing"] = None
|
self._dbphotos[uuid]["isMissing"] = None
|
||||||
|
self._dbphotos[uuid]["adjustmentUuid"] = None
|
||||||
|
self._dbphotos[uuid]["adjustmentFormatID"] = None
|
||||||
|
|
||||||
# Get extended description
|
# Get extended description
|
||||||
c.execute(
|
c.execute(
|
||||||
@@ -915,7 +918,9 @@ class PhotosDB:
|
|||||||
|
|
||||||
# get information about adjusted/edited photos
|
# get information about adjusted/edited photos
|
||||||
c.execute(
|
c.execute(
|
||||||
"SELECT ZGENERICASSET.ZUUID, ZGENERICASSET.ZHASADJUSTMENTS, ZUNMANAGEDADJUSTMENT.ZADJUSTMENTFORMATIDENTIFIER "
|
"SELECT ZGENERICASSET.ZUUID, "
|
||||||
|
"ZGENERICASSET.ZHASADJUSTMENTS, "
|
||||||
|
"ZUNMANAGEDADJUSTMENT.ZADJUSTMENTFORMATIDENTIFIER "
|
||||||
"FROM ZGENERICASSET, ZUNMANAGEDADJUSTMENT "
|
"FROM ZGENERICASSET, ZUNMANAGEDADJUSTMENT "
|
||||||
"JOIN ZADDITIONALASSETATTRIBUTES ON ZADDITIONALASSETATTRIBUTES.ZASSET = ZGENERICASSET.Z_PK "
|
"JOIN ZADDITIONALASSETATTRIBUTES ON ZADDITIONALASSETATTRIBUTES.ZASSET = ZGENERICASSET.Z_PK "
|
||||||
"WHERE ZADDITIONALASSETATTRIBUTES.ZUNMANAGEDADJUSTMENT = ZUNMANAGEDADJUSTMENT.Z_PK "
|
"WHERE ZADDITIONALASSETATTRIBUTES.ZUNMANAGEDADJUSTMENT = ZUNMANAGEDADJUSTMENT.Z_PK "
|
||||||
@@ -924,7 +929,7 @@ class PhotosDB:
|
|||||||
for row in c:
|
for row in c:
|
||||||
uuid = row[0]
|
uuid = row[0]
|
||||||
if uuid in self._dbphotos:
|
if uuid in self._dbphotos:
|
||||||
self._dbphotos[uuid]["adjustmentID"] = row[2]
|
self._dbphotos[uuid]["adjustmentFormatID"] = row[2]
|
||||||
else:
|
else:
|
||||||
logging.debug(
|
logging.debug(
|
||||||
f"WARNING: found adjustmentformatidentifier {row[2]} but no photo for uuid {row[0]}"
|
f"WARNING: found adjustmentformatidentifier {row[2]} but no photo for uuid {row[0]}"
|
||||||
@@ -1241,9 +1246,17 @@ class PhotoInfo:
|
|||||||
return True if self.__info["isMissing"] == 1 else False
|
return True if self.__info["isMissing"] == 1 else False
|
||||||
|
|
||||||
def hasadjustments(self):
|
def hasadjustments(self):
|
||||||
""" True if picture has adjustments """
|
""" True if picture has adjustments / edits """
|
||||||
return True if self.__info["hasAdjustments"] == 1 else False
|
return True if self.__info["hasAdjustments"] == 1 else False
|
||||||
|
|
||||||
|
def external_edit(self):
|
||||||
|
""" Returns True if picture was edited outside of Photos using external editor """
|
||||||
|
return (
|
||||||
|
True
|
||||||
|
if self.__info["adjustmentFormatID"] == "com.apple.Photos.externalEdit"
|
||||||
|
else False
|
||||||
|
)
|
||||||
|
|
||||||
def favorite(self):
|
def favorite(self):
|
||||||
""" True if picture is marked as favorite """
|
""" True if picture is marked as favorite """
|
||||||
return True if self.__info["favorite"] == 1 else False
|
return True if self.__info["favorite"] == 1 else False
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -7,7 +7,7 @@
|
|||||||
<key>hostuuid</key>
|
<key>hostuuid</key>
|
||||||
<string>9575E48B-8D5F-5654-ABAC-4431B1167324</string>
|
<string>9575E48B-8D5F-5654-ABAC-4431B1167324</string>
|
||||||
<key>pid</key>
|
<key>pid</key>
|
||||||
<integer>1368</integer>
|
<integer>2774</integer>
|
||||||
<key>processname</key>
|
<key>processname</key>
|
||||||
<string>photolibraryd</string>
|
<string>photolibraryd</string>
|
||||||
<key>uid</key>
|
<key>uid</key>
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -3,24 +3,24 @@
|
|||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
<key>BackgroundHighlightCollection</key>
|
<key>BackgroundHighlightCollection</key>
|
||||||
<date>2019-11-13T03:46:27Z</date>
|
<date>2019-12-01T15:27:50Z</date>
|
||||||
<key>BackgroundHighlightEnrichment</key>
|
<key>BackgroundHighlightEnrichment</key>
|
||||||
<date>2019-11-13T03:46:27Z</date>
|
<date>2019-12-01T15:27:50Z</date>
|
||||||
<key>BackgroundJobAssetRevGeocode</key>
|
<key>BackgroundJobAssetRevGeocode</key>
|
||||||
<date>2019-11-13T03:46:27Z</date>
|
<date>2019-12-01T15:27:51Z</date>
|
||||||
<key>BackgroundJobSearch</key>
|
<key>BackgroundJobSearch</key>
|
||||||
<date>2019-11-13T03:46:27Z</date>
|
<date>2019-12-01T15:27:51Z</date>
|
||||||
<key>BackgroundPeopleSuggestion</key>
|
<key>BackgroundPeopleSuggestion</key>
|
||||||
<date>2019-11-13T03:46:27Z</date>
|
<date>2019-12-01T15:27:50Z</date>
|
||||||
<key>BackgroundUserBehaviorProcessor</key>
|
<key>BackgroundUserBehaviorProcessor</key>
|
||||||
<date>2019-11-13T03:46:28Z</date>
|
<date>2019-12-01T15:27:51Z</date>
|
||||||
<key>PhotoAnalysisGraphLastBackgroundGraphConsistencyUpdateJobDateKey</key>
|
<key>PhotoAnalysisGraphLastBackgroundGraphConsistencyUpdateJobDateKey</key>
|
||||||
<date>2019-11-13T03:46:28Z</date>
|
<date>2019-11-13T03:46:28Z</date>
|
||||||
<key>PhotoAnalysisGraphLastBackgroundGraphRebuildJobDate</key>
|
<key>PhotoAnalysisGraphLastBackgroundGraphRebuildJobDate</key>
|
||||||
<date>2019-11-13T03:46:27Z</date>
|
<date>2019-11-13T03:46:27Z</date>
|
||||||
<key>PhotoAnalysisGraphLastBackgroundMemoryGenerationJobDate</key>
|
<key>PhotoAnalysisGraphLastBackgroundMemoryGenerationJobDate</key>
|
||||||
<date>2019-11-13T03:46:28Z</date>
|
<date>2019-12-01T15:27:51Z</date>
|
||||||
<key>SiriPortraitDonation</key>
|
<key>SiriPortraitDonation</key>
|
||||||
<date>2019-11-13T03:46:28Z</date>
|
<date>2019-12-01T15:27:51Z</date>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -3,7 +3,7 @@
|
|||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
<key>FaceIDModelLastGenerationKey</key>
|
<key>FaceIDModelLastGenerationKey</key>
|
||||||
<date>2019-11-13T03:46:28Z</date>
|
<date>2019-12-01T15:27:51Z</date>
|
||||||
<key>LastContactClassificationKey</key>
|
<key>LastContactClassificationKey</key>
|
||||||
<date>2019-11-13T03:46:29Z</date>
|
<date>2019-11-13T03:46:29Z</date>
|
||||||
</dict>
|
</dict>
|
||||||
|
|||||||
@@ -3,6 +3,6 @@
|
|||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
<key>PVClustererBringUpState</key>
|
<key>PVClustererBringUpState</key>
|
||||||
<integer>50</integer>
|
<integer>40</integer>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
<key>IncrementalPersonProcessingStage</key>
|
<key>IncrementalPersonProcessingStage</key>
|
||||||
<integer>6</integer>
|
<integer>5</integer>
|
||||||
<key>PersonBuilderLastMinimumFaceGroupSizeForCreatingMergeCandidates</key>
|
<key>PersonBuilderLastMinimumFaceGroupSizeForCreatingMergeCandidates</key>
|
||||||
<integer>15</integer>
|
<integer>15</integer>
|
||||||
<key>PersonBuilderMergeCandidatesEnabled</key>
|
<key>PersonBuilderMergeCandidatesEnabled</key>
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 485 KiB After Width: | Height: | Size: 383 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 118 KiB After Width: | Height: | Size: 104 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>adjustmentBaseVersion</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>adjustmentData</key>
|
||||||
|
<data>
|
||||||
|
shkyAAAAAAACAAAA
|
||||||
|
</data>
|
||||||
|
<key>adjustmentEditorBundleID</key>
|
||||||
|
<string>com.apple.Photos</string>
|
||||||
|
<key>adjustmentFormatIdentifier</key>
|
||||||
|
<string>com.apple.Photos.externalEdit</string>
|
||||||
|
<key>adjustmentFormatVersion</key>
|
||||||
|
<string>1</string>
|
||||||
|
<key>adjustmentTimestamp</key>
|
||||||
|
<date>2019-12-01T15:27:48Z</date>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 1.2 MiB |
@@ -44,7 +44,7 @@ def test_db_version():
|
|||||||
|
|
||||||
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
|
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
|
||||||
# assert photosdb.get_db_version() in osxphotos._TESTED_DB_VERSIONS
|
# assert photosdb.get_db_version() in osxphotos._TESTED_DB_VERSIONS
|
||||||
assert photosdb.get_db_version() == "6000"
|
assert photosdb.get_db_version() == "6000"
|
||||||
|
|
||||||
|
|
||||||
def test_os_version():
|
def test_os_version():
|
||||||
@@ -231,6 +231,30 @@ def test_hasadjustments2():
|
|||||||
assert p.hasadjustments() == False
|
assert p.hasadjustments() == False
|
||||||
|
|
||||||
|
|
||||||
|
def test_external_edit1():
|
||||||
|
# test image has been edited in external editor
|
||||||
|
import osxphotos
|
||||||
|
|
||||||
|
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
|
||||||
|
photos = photosdb.photos(uuid=["DC99FBDD-7A52-4100-A5BB-344131646C30"])
|
||||||
|
assert len(photos) == 1
|
||||||
|
p = photos[0]
|
||||||
|
|
||||||
|
assert p.external_edit() == True
|
||||||
|
|
||||||
|
|
||||||
|
def test_external_edit2():
|
||||||
|
# test image has not been edited in external editor
|
||||||
|
import osxphotos
|
||||||
|
|
||||||
|
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
|
||||||
|
photos = photosdb.photos(uuid=["E9BC5C36-7CD1-40A1-A72B-8B8FAC227D51"])
|
||||||
|
assert len(photos) == 1
|
||||||
|
p = photos[0]
|
||||||
|
|
||||||
|
assert p.external_edit() == False
|
||||||
|
|
||||||
|
|
||||||
def test_path_edited1():
|
def test_path_edited1():
|
||||||
# test a valid edited path
|
# test a valid edited path
|
||||||
import osxphotos
|
import osxphotos
|
||||||
|
|||||||
Reference in New Issue
Block a user