AlbumInfo.photos now returns photos in album sort order

This commit is contained in:
Rhet Turnbull
2020-07-06 10:06:11 -07:00
parent fcff8ec5f8
commit 9d820a0557
37 changed files with 95 additions and 31 deletions

View File

@@ -5,6 +5,6 @@
<key>PhotoAnalysisGraphLastBackgroundGraphRebuildJobDate</key>
<date>2020-04-25T23:54:43Z</date>
<key>PhotoAnalysisGraphLastBackgroundMemoryGenerationJobDate</key>
<date>2020-06-27T16:03:48Z</date>
<date>2020-07-06T16:39:04Z</date>
</dict>
</plist>

View File

@@ -11,6 +11,6 @@
<key>PLLastRevGeoForcedProviderOutOfDateCheckVersionKey</key>
<integer>1</integer>
<key>PLLastRevGeoVerFileFetchDateKey</key>
<date>2020-06-27T16:03:43Z</date>
<date>2020-07-06T16:39:09Z</date>
</dict>
</plist>

View File

@@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>LastHistoryRowId</key>
<integer>651</integer>
<integer>664</integer>
<key>LibraryBuildTag</key>
<string>D8C4AAA1-3AB6-4A65-BEBD-99CC3E5D433E</string>
<key>LibrarySchemaVersion</key>

View File

@@ -9,7 +9,7 @@
<key>HistoricalMarker</key>
<dict>
<key>LastHistoryRowId</key>
<integer>606</integer>
<integer>664</integer>
<key>LibraryBuildTag</key>
<string>D8C4AAA1-3AB6-4A65-BEBD-99CC3E5D433E</string>
<key>LibrarySchemaVersion</key>
@@ -24,7 +24,7 @@
<key>SnapshotCompletedDate</key>
<date>2019-07-27T13:16:43Z</date>
<key>SnapshotLastValidated</key>
<date>2020-06-27T16:03:33Z</date>
<date>2020-07-06T16:39:02Z</date>
<key>SnapshotTables</key>
<dict/>
</dict>

View File

@@ -7,7 +7,7 @@
<key>hostuuid</key>
<string>9575E48B-8D5F-5654-ABAC-4431B1167324</string>
<key>pid</key>
<integer>1613</integer>
<integer>1743</integer>
<key>processname</key>
<string>photolibraryd</string>
<key>uid</key>

View File

@@ -80,6 +80,12 @@ UUID_PUMPKIN_FARM = [
"1EB2B765-0765-43BA-A90C-0D0580E6172C",
]
ALBUM_SORT_ORDER = [
"1EB2B765-0765-43BA-A90C-0D0580E6172C",
"F12384F6-CD17-4151-ACBA-AE0E3688539E",
"D79B8D77-BFFC-460B-9312-034F2877D35B",
]
ALBUM_KEY_PHOTO = "D79B8D77-BFFC-460B-9312-034F2877D35B"
def test_init1():
# test named argument
@@ -217,6 +223,15 @@ def test_albums_as_dict():
assert albums["Pumpkin Farm"] == 3
assert albums == ALBUM_DICT
def test_album_sort_order():
import osxphotos
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
album = [a for a in photosdb.album_info if a.title == "Pumpkin Farm"][0]
photos = album.photos
uuids = [p.uuid for p in photos]
assert uuids == ALBUM_SORT_ORDER
def test_attributes():
import datetime

View File

@@ -47,6 +47,13 @@ UUID_DICT = {
"has_adjustments": "6bxcNnzRQKGnK4uPrCJ9UQ",
}
ALBUM_SORT_ORDER = [
"HrK3ZQdlQ7qpDA0FgOYXLA",
"8SOE9s0XQVGsuq4ONohTng",
"15uNd7%8RguTEgNPKHfTWw",
]
ALBUM_KEY_PHOTO = "15uNd7%8RguTEgNPKHfTWw"
PHOTOS_DB_LEN = 8
PHOTOS_NOT_IN_TRASH_LEN = 7
PHOTOS_IN_TRASH_LEN = 1
@@ -136,6 +143,17 @@ def test_albums_as_dict():
assert albums == ALBUM_DICT
def test_album_sort_order():
import osxphotos
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
album = [a for a in photosdb.album_info if a.title == "Pumpkin Farm"][0]
photos = album.photos
uuids = [p.uuid for p in photos]
assert uuids == ALBUM_SORT_ORDER
def test_attributes():
import datetime
import osxphotos