Skip to content

Commit

Permalink
Feature add sequoia support (#1572)
Browse files Browse the repository at this point in the history
* Initial support for Sequoia / Photos 10

* Fix test for linux

* WTF

* Fixed case sensitive names

* Fixed case sensitive names

* Updated readme
  • Loading branch information
RhetTbull committed Jun 12, 2024
1 parent 1daf76a commit 9b87ec2
Show file tree
Hide file tree
Showing 296 changed files with 3,616 additions and 284 deletions.
559 changes: 281 additions & 278 deletions README.md

Large diffs are not rendered by default.

27 changes: 27 additions & 0 deletions osxphotos/_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
_PHOTOS_7_MODEL_VERSION = [15000, 15999] # Dev preview: 15134, 12.1: 15331
_PHOTOS_8_MODEL_VERSION = [16000, 16999] # Ventura dev preview: 16119
_PHOTOS_9_MODEL_VERSION = [17000, 17999] # Sonoma dev preview: 17120
_PHOTOS_10_MODEL_VERSION = [18000, 18999] # Sequoia dev preview: 18164

# the preview versions of 12.0.0 had a difference schema for syndication info so need to check model version before processing
_PHOTOS_SYNDICATION_MODEL_VERSION = 15323 # 12.0.1
Expand All @@ -75,6 +76,8 @@
"HDR_TYPE": "ZCUSTOMRENDEREDVALUE",
"DETECTED_FACE_PERSON_FK": "ZDETECTEDFACE.ZPERSON",
"DETECTED_FACE_ASSET_FK": "ZDETECTEDFACE.ZASSET",
"MASTER_FINGERPRINT": "ZADDITIONALASSETATTRIBUTES.ZMASTERFINGERPRINT",
"HAS_ADJUSTMENTS": "ZGENERICASSET.ZHASADJUSTMENTS",
},
6: {
"ASSET": "ZASSET",
Expand All @@ -89,6 +92,8 @@
"HDR_TYPE": "ZCUSTOMRENDEREDVALUE",
"DETECTED_FACE_PERSON_FK": "ZDETECTEDFACE.ZPERSON",
"DETECTED_FACE_ASSET_FK": "ZDETECTEDFACE.ZASSET",
"MASTER_FINGERPRINT": "ZADDITIONALASSETATTRIBUTES.ZMASTERFINGERPRINT",
"HAS_ADJUSTMENTS": "ZASSET.ZHASADJUSTMENTS",
},
7: {
"ASSET": "ZASSET",
Expand All @@ -103,6 +108,8 @@
"HDR_TYPE": "ZHDRTYPE",
"DETECTED_FACE_PERSON_FK": "ZDETECTEDFACE.ZPERSON",
"DETECTED_FACE_ASSET_FK": "ZDETECTEDFACE.ZASSET",
"MASTER_FINGERPRINT": "ZADDITIONALASSETATTRIBUTES.ZMASTERFINGERPRINT",
"HAS_ADJUSTMENTS": "ZASSET.ZHASADJUSTMENTS",
},
8: {
"ASSET": "ZASSET",
Expand All @@ -117,6 +124,8 @@
"HDR_TYPE": "ZHDRTYPE",
"DETECTED_FACE_PERSON_FK": "ZDETECTEDFACE.ZPERSON",
"DETECTED_FACE_ASSET_FK": "ZDETECTEDFACE.ZASSET",
"MASTER_FINGERPRINT": "ZADDITIONALASSETATTRIBUTES.ZMASTERFINGERPRINT",
"HAS_ADJUSTMENTS": "ZASSET.ZHASADJUSTMENTS",
},
9: {
"ASSET": "ZASSET",
Expand All @@ -131,6 +140,24 @@
"HDR_TYPE": "ZHDRTYPE",
"DETECTED_FACE_PERSON_FK": "ZDETECTEDFACE.ZPERSONFORFACE",
"DETECTED_FACE_ASSET_FK": "ZDETECTEDFACE.ZASSETFORFACE",
"MASTER_FINGERPRINT": "ZADDITIONALASSETATTRIBUTES.ZMASTERFINGERPRINT",
"HAS_ADJUSTMENTS": "ZASSET.ZHASADJUSTMENTS",
},
10: {
"ASSET": "ZASSET",
"KEYWORD_JOIN": "Z_1KEYWORDS.Z_48KEYWORDS",
"ALBUM_JOIN": "Z_31ASSETS.Z_3ASSETS",
"ALBUM_SORT_ORDER": "Z_31ASSETS.Z_FOK_3ASSETS",
"IMPORT_FOK": "null",
"DEPTH_STATE": "ZASSET.ZDEPTHTYPE",
"UTI_ORIGINAL": "ZINTERNALRESOURCE.ZCOMPACTUTI",
"ASSET_ALBUM_JOIN": "Z_31ASSETS.Z_31ALBUMS",
"ASSET_ALBUM_TABLE": "Z_31ASSETS",
"HDR_TYPE": "ZHDRTYPE",
"DETECTED_FACE_PERSON_FK": "ZDETECTEDFACE.ZPERSONFORFACE",
"DETECTED_FACE_ASSET_FK": "ZDETECTEDFACE.ZASSETFORFACE",
"MASTER_FINGERPRINT": "ZADDITIONALASSETATTRIBUTES.ZORIGINALSTABLEHASH",
"HAS_ADJUSTMENTS": "ZASSET.ZADJUSTMENTSSTATE",
},
}

Expand Down
10 changes: 6 additions & 4 deletions osxphotos/photosdb/photosdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -1714,6 +1714,8 @@ def _process_database5(self):
depth_state = _DB_TABLE_NAMES[photos_ver]["DEPTH_STATE"]
uti_original_column = _DB_TABLE_NAMES[photos_ver]["UTI_ORIGINAL"]
hdr_type_column = _DB_TABLE_NAMES[photos_ver]["HDR_TYPE"]
master_fingerprint = _DB_TABLE_NAMES[photos_ver]["MASTER_FINGERPRINT"]
has_adjustments = _DB_TABLE_NAMES[photos_ver]["HAS_ADJUSTMENTS"]

# Look for all combinations of persons and pictures
logger.debug(f"Getting information about persons")
Expand Down Expand Up @@ -1971,7 +1973,7 @@ def _process_database5(self):
verbose("Processing photo details.")
c.execute(
f"""SELECT {asset_table}.ZUUID,
ZADDITIONALASSETATTRIBUTES.ZMASTERFINGERPRINT,
{master_fingerprint},
ZADDITIONALASSETATTRIBUTES.ZTITLE,
ZADDITIONALASSETATTRIBUTES.ZORIGINALFILENAME,
{asset_table}.ZMODIFICATIONDATE,
Expand All @@ -1985,7 +1987,7 @@ def _process_database5(self):
{asset_table}.ZFILENAME,
{asset_table}.ZLATITUDE,
{asset_table}.ZLONGITUDE,
{asset_table}.ZHASADJUSTMENTS,
{has_adjustments},
{asset_table}.ZCLOUDBATCHPUBLISHDATE,
{asset_table}.ZKIND,
{asset_table}.ZUNIFORMTYPEIDENTIFIER,
Expand Down Expand Up @@ -2354,7 +2356,7 @@ def _process_database5(self):
# get information about adjusted/edited photos
c.execute(
f"""SELECT {asset_table}.ZUUID,
{asset_table}.ZHASADJUSTMENTS,
{has_adjustments},
ZUNMANAGEDADJUSTMENT.ZADJUSTMENTFORMATIDENTIFIER
FROM {asset_table}, ZUNMANAGEDADJUSTMENT
JOIN ZADDITIONALASSETATTRIBUTES ON ZADDITIONALASSETATTRIBUTES.ZASSET = {asset_table}.Z_PK
Expand Down Expand Up @@ -2432,7 +2434,7 @@ def _process_database5(self):
ZINTERNALRESOURCE.ZREMOTEAVAILABILITY
FROM {asset_table}
JOIN ZADDITIONALASSETATTRIBUTES ON ZADDITIONALASSETATTRIBUTES.ZASSET = {asset_table}.Z_PK
JOIN ZINTERNALRESOURCE ON ZINTERNALRESOURCE.ZFINGERPRINT = ZADDITIONALASSETATTRIBUTES.ZMASTERFINGERPRINT """
JOIN ZINTERNALRESOURCE ON ZINTERNALRESOURCE.ZFINGERPRINT = {master_fingerprint} """
)

for row in c:
Expand Down
5 changes: 4 additions & 1 deletion osxphotos/photosdb/photosdb_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
_PHOTOS_7_MODEL_VERSION,
_PHOTOS_8_MODEL_VERSION,
_PHOTOS_9_MODEL_VERSION,
_PHOTOS_10_MODEL_VERSION,
_TESTED_DB_VERSIONS,
)
from ..sqlite_utils import sqlite_open_ro
Expand Down Expand Up @@ -135,10 +136,12 @@ def get_photos_version_from_model(db_file: str) -> int:
return 8
if _PHOTOS_9_MODEL_VERSION[0] <= model_ver <= _PHOTOS_9_MODEL_VERSION[1]:
return 9
if _PHOTOS_10_MODEL_VERSION[0] <= model_ver <= _PHOTOS_10_MODEL_VERSION[1]:
return 10
logger.warning(
f"Unknown db / model version for {db_file}: model_ver={model_ver}; assuming latest version"
)
return 9
return 10


def get_photos_library_version(library_path: str | pathlib.Path) -> int:
Expand Down
Binary file modified tests/Test-14.0.0.photoslibrary/database/Photos.sqlite
Binary file not shown.
Binary file modified tests/Test-14.0.0.photoslibrary/database/Photos.sqlite-shm
Binary file not shown.
Binary file modified tests/Test-14.0.0.photoslibrary/database/Photos.sqlite-wal
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?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>LibrarySchemaVersion</key>
<integer>5001</integer>
<key>MetaSchemaVersion</key>
<integer>3</integer>
</dict>
</plist>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?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>hostname</key>
<string>Turals-Macbook-Pro.local</string>
<key>hostuuid</key>
<string>5E17AD36-A1D3-512D-ADB3-179E948B2295</string>
<key>pid</key>
<integer>1128</integer>
<key>processname</key>
<string>photolibraryd</string>
<key>uid</key>
<integer>501</integer>
</dict>
</plist>
Binary file not shown.
Binary file not shown.
Empty file.
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.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?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>journalSerialNumber</key>
<integer>1</integer>
<key>version</key>
<integer>1</integer>
</dict>
</plist>
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.
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.
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.
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.
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?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>build</key>
<string>24A5264n</string>
<key>heartbeat_age</key>
<integer>1718062498</integer>
<key>lastSent</key>
<integer>-1</integer>
<key>parentDirectory_age</key>
<integer>1718062498</integer>
<key>pcA_age</key>
<integer>-1</integer>
<key>pcA_obj_count</key>
<integer>-1</integer>
<key>pcA_wipes</key>
<integer>0</integer>
<key>pcA_wipes_aggregate</key>
<integer>0</integer>
<key>pcB_age</key>
<integer>-1</integer>
<key>pcB_obj_count</key>
<integer>-1</integer>
<key>pcB_wipes</key>
<integer>0</integer>
<key>pcB_wipes_aggregate</key>
<integer>0</integer>
<key>pcCX_age</key>
<integer>-1</integer>
<key>pcCX_obj_count</key>
<integer>-1</integer>
<key>pcCX_wipes</key>
<integer>0</integer>
<key>pcCX_wipes_aggregate</key>
<integer>0</integer>
<key>pcC_age</key>
<integer>1718062498</integer>
<key>pcC_obj_count</key>
<integer>1</integer>
<key>pcC_wipes</key>
<integer>0</integer>
<key>pcC_wipes_aggregate</key>
<integer>0</integer>
<key>pcPriority_age</key>
<integer>-1</integer>
<key>pcPriority_obj_count</key>
<integer>-1</integer>
<key>pcPriority_wipes</key>
<integer>0</integer>
<key>pcPriority_wipes_aggregate</key>
<integer>0</integer>
<key>previousbuild</key>
<string>unknown</string>
<key>previousspotlightversion</key>
<string>unknown</string>
<key>rootsinstalled</key>
<false/>
<key>spotlightversion</key>
<string>2305.1.5</string>
<key>timesinceboot</key>
<integer>1718056899</integer>
<key>timesinceupdate</key>
<integer>-1</integer>
<key>vectorindexon</key>
<false/>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?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>pcA_lastAnalytics</key>
<integer>-1</integer>
<key>pcA_lastOpen</key>
<integer>-1</integer>
<key>pcB_lastAnalytics</key>
<integer>-1</integer>
<key>pcB_lastOpen</key>
<integer>-1</integer>
<key>pcCX_lastAnalytics</key>
<integer>-1</integer>
<key>pcCX_lastOpen</key>
<integer>-1</integer>
<key>pcC_lastAnalytics</key>
<integer>-1</integer>
<key>pcC_lastOpen</key>
<integer>1718062498</integer>
<key>pcPriority_lastAnalytics</key>
<integer>-1</integer>
<key>pcPriority_lastOpen</key>
<integer>-1</integer>
</dict>
</plist>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?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>BlacklistedMeaningsByMeaning</key>
<dict/>
<key>SceneWhitelist</key>
<array>
<string>Art</string>
<string>Flower</string>
<string>Food</string>
<string>Jewelry</string>
<string>Lake</string>
<string>Shore</string>
<string>Sport</string>
<string>Vehicle</string>
</array>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?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>insertAlbum</key>
<array/>
<key>insertAsset</key>
<array/>
<key>insertHighlight</key>
<array/>
<key>insertMemory</key>
<array/>
<key>insertMoment</key>
<array/>
<key>removeAlbum</key>
<array/>
<key>removeAsset</key>
<array/>
<key>removeHighlight</key>
<array/>
<key>removeMemory</key>
<array/>
<key>removeMoment</key>
<array/>
<key>renamePerson</key>
<array/>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?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>embeddingVersion</key>
<string>1</string>
<key>featureFlags</key>
<string>319</string>
<key>featuredContentAllowed</key>
<string>1</string>
<key>localeIdentifier</key>
<string>en_US</string>
<key>sceneTaxonomySHA</key>
<string>64d078bafc0035e1ec26dfa565c2ac0479fcbab329fda1c16cd17e0fdbf2f4c0,4afa5d3c45c08a664cf73cff957aaeeae3a325d2970aada51268407b9ad0f03e</string>
<key>searchIndexVersion</key>
<string>16025</string>
</dict>
</plist>
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?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>MigrationService</key>
<dict>
<key>State</key>
<integer>4</integer>
</dict>
<key>MigrationService.LastCompletedTask</key>
<integer>12</integer>
<key>MigrationService.ValidationCounts</key>
<dict>
<key>MigrationDetectedFaceprint</key>
<integer>6</integer>
<key>MigrationManagedAsset</key>
<integer>0</integer>
<key>MigrationSceneClassification</key>
<integer>44</integer>
<key>MigrationUnmanagedAdjustment</key>
<integer>0</integer>
<key>RDVersion.cloudLocalState.CPLIsNotPushed</key>
<integer>7</integer>
</dict>
</dict>
</plist>
Loading

0 comments on commit 9b87ec2

Please sign in to comment.