Fixed album sort order for custom sort, #497
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -7,7 +7,7 @@
|
||||
<key>hostuuid</key>
|
||||
<string>585B80BF-8D1F-55EF-A9E8-6CF4E5523959</string>
|
||||
<key>pid</key>
|
||||
<integer>570</integer>
|
||||
<integer>1961</integer>
|
||||
<key>processname</key>
|
||||
<string>photolibraryd</string>
|
||||
<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.
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">
|
||||
<dict>
|
||||
<key>BackgroundHighlightCollection</key>
|
||||
<date>2021-03-13T16:38:25Z</date>
|
||||
<date>2021-07-20T05:48:01Z</date>
|
||||
<key>BackgroundHighlightEnrichment</key>
|
||||
<date>2021-03-13T16:38:24Z</date>
|
||||
<date>2021-07-20T05:48:00Z</date>
|
||||
<key>BackgroundJobAssetRevGeocode</key>
|
||||
<date>2021-03-13T16:38:25Z</date>
|
||||
<date>2021-07-20T07:05:31Z</date>
|
||||
<key>BackgroundJobSearch</key>
|
||||
<date>2021-03-13T16:38:25Z</date>
|
||||
<date>2021-07-20T05:48:01Z</date>
|
||||
<key>BackgroundPeopleSuggestion</key>
|
||||
<date>2021-03-13T16:38:23Z</date>
|
||||
<date>2021-07-20T05:48:00Z</date>
|
||||
<key>BackgroundUserBehaviorProcessor</key>
|
||||
<date>2021-03-13T16:38:25Z</date>
|
||||
<date>2021-07-20T05:48:01Z</date>
|
||||
<key>PhotoAnalysisGraphLastBackgroundGraphConsistencyUpdateJobDateKey</key>
|
||||
<date>2020-10-17T23:45:33Z</date>
|
||||
<date>2021-07-20T05:48:08Z</date>
|
||||
<key>PhotoAnalysisGraphLastBackgroundGraphRebuildJobDate</key>
|
||||
<date>2020-10-17T23:45:24Z</date>
|
||||
<date>2021-07-20T05:47:59Z</date>
|
||||
<key>PhotoAnalysisGraphLastBackgroundMemoryGenerationJobDate</key>
|
||||
<date>2021-03-13T16:38:25Z</date>
|
||||
<date>2021-07-20T05:48:01Z</date>
|
||||
<key>SiriPortraitDonation</key>
|
||||
<date>2021-03-13T16:38:25Z</date>
|
||||
<date>2021-07-20T05:48:01Z</date>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -3,8 +3,8 @@
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>FaceIDModelLastGenerationKey</key>
|
||||
<date>2020-10-17T23:45:32Z</date>
|
||||
<date>2021-07-20T05:48:02Z</date>
|
||||
<key>LastContactClassificationKey</key>
|
||||
<date>2020-10-17T23:45:54Z</date>
|
||||
<date>2021-07-20T05:48:05Z</date>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -3,7 +3,7 @@
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>coalesceDate</key>
|
||||
<date>2020-04-11T19:26:12Z</date>
|
||||
<date>2021-07-20T12:21:20Z</date>
|
||||
<key>coalescePayloadVersion</key>
|
||||
<integer>1</integer>
|
||||
<key>currentPayloadVersion</key>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -3,7 +3,7 @@
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>coalesceDate</key>
|
||||
<date>2020-05-29T15:20:05Z</date>
|
||||
<date>2021-07-20T12:21:21Z</date>
|
||||
<key>coalescePayloadVersion</key>
|
||||
<integer>10</integer>
|
||||
<key>currentPayloadVersion</key>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -3,7 +3,7 @@
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>coalesceDate</key>
|
||||
<date>2019-10-27T15:36:05Z</date>
|
||||
<date>2021-07-20T12:21:20Z</date>
|
||||
<key>coalescePayloadVersion</key>
|
||||
<integer>1</integer>
|
||||
<key>currentPayloadVersion</key>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -3,7 +3,7 @@
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>coalesceDate</key>
|
||||
<date>2020-05-29T15:20:05Z</date>
|
||||
<date>2021-07-20T12:21:21Z</date>
|
||||
<key>coalescePayloadVersion</key>
|
||||
<integer>1</integer>
|
||||
<key>currentPayloadVersion</key>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -3,7 +3,7 @@
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>coalesceDate</key>
|
||||
<date>2020-05-29T15:20:05Z</date>
|
||||
<date>2021-07-20T12:21:20Z</date>
|
||||
<key>coalescePayloadVersion</key>
|
||||
<integer>1</integer>
|
||||
<key>currentPayloadVersion</key>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -2,6 +2,10 @@
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>coalesceDate</key>
|
||||
<date>2021-07-20T12:21:20Z</date>
|
||||
<key>coalescePayloadVersion</key>
|
||||
<integer>1</integer>
|
||||
<key>currentPayloadVersion</key>
|
||||
<integer>1</integer>
|
||||
<key>snapshotDate</key>
|
||||
|
||||
@@ -2,11 +2,11 @@ import pytest
|
||||
|
||||
import osxphotos
|
||||
|
||||
from osxphotos._constants import _UNKNOWN_PERSON
|
||||
from osxphotos._constants import _UNKNOWN_PERSON, AlbumSortOrder
|
||||
|
||||
PHOTOS_DB = "./tests/Test-10.15.4.photoslibrary/database/photos.db"
|
||||
PHOTOS_DB = "./tests/Test-10.15.7.photoslibrary/database/photos.db"
|
||||
|
||||
TOP_LEVEL_FOLDERS = ["Folder1", "Folder2"]
|
||||
TOP_LEVEL_FOLDERS = ["Folder1", "Folder2", "Pumpkin Farm"]
|
||||
|
||||
TOP_LEVEL_CHILDREN = ["SubFolder1", "SubFolder2"]
|
||||
|
||||
@@ -15,25 +15,73 @@ FOLDER_ALBUM_DICT = {
|
||||
"SubFolder1": [],
|
||||
"SubFolder2": ["AlbumInFolder"],
|
||||
"Folder2": ["Raw"],
|
||||
"Pumpkin Farm": [],
|
||||
}
|
||||
|
||||
ALBUM_NAMES = ["Pumpkin Farm", "AlbumInFolder", "Test Album", "Test Album", "Raw"]
|
||||
ALBUM_NAMES = [
|
||||
"2018-10 - Sponsion, Museum, Frühstück, Römermuseum",
|
||||
"2019-10/11 Paris Clermont",
|
||||
"AlbumInFolder",
|
||||
"EmptyAlbum",
|
||||
"I have a deleted twin",
|
||||
"Multi Keyword",
|
||||
"Pumpkin Farm",
|
||||
"Raw",
|
||||
"Sorted Manual",
|
||||
"Sorted Newest First",
|
||||
"Sorted Oldest First",
|
||||
"Sorted Title",
|
||||
"Test Album",
|
||||
"Test Album",
|
||||
]
|
||||
|
||||
ALBUM_PARENT_DICT = {
|
||||
"Pumpkin Farm": None,
|
||||
"2018-10 - Sponsion, Museum, Frühstück, Römermuseum": None,
|
||||
"2019-10/11 Paris Clermont": None,
|
||||
"AlbumInFolder": "SubFolder2",
|
||||
"Test Album": None,
|
||||
"EmptyAlbum": None,
|
||||
"I have a deleted twin": None,
|
||||
"Multi Keyword": None,
|
||||
"Pumpkin Farm": None,
|
||||
"Raw": "Folder2",
|
||||
"Sorted Manual": None,
|
||||
"Sorted Newest First": None,
|
||||
"Sorted Oldest First": None,
|
||||
"Sorted Title": None,
|
||||
"Test Album": None,
|
||||
}
|
||||
|
||||
ALBUM_FOLDER_NAMES_DICT = {
|
||||
"Pumpkin Farm": [],
|
||||
"2018-10 - Sponsion, Museum, Frühstück, Römermuseum": [],
|
||||
"2019-10/11 Paris Clermont": [],
|
||||
"AlbumInFolder": ["Folder1", "SubFolder2"],
|
||||
"Test Album": [],
|
||||
"EmptyAlbum": [],
|
||||
"I have a deleted twin": [],
|
||||
"Multi Keyword": [],
|
||||
"Pumpkin Farm": [],
|
||||
"Raw": ["Folder2"],
|
||||
"Sorted Manual": [],
|
||||
"Sorted Newest First": [],
|
||||
"Sorted Oldest First": [],
|
||||
"Sorted Title": [],
|
||||
"Test Album": [],
|
||||
}
|
||||
|
||||
ALBUM_LEN_DICT = {"Pumpkin Farm": 3, "AlbumInFolder": 2, "Test Album": 1, "Raw": 4}
|
||||
ALBUM_LEN_DICT = {
|
||||
"2018-10 - Sponsion, Museum, Frühstück, Römermuseum": 1,
|
||||
"2019-10/11 Paris Clermont": 1,
|
||||
"AlbumInFolder": 2,
|
||||
"EmptyAlbum": 0,
|
||||
"I have a deleted twin": 1,
|
||||
"Multi Keyword": 2,
|
||||
"Pumpkin Farm": 3,
|
||||
"Raw": 4,
|
||||
"Sorted Manual": 3,
|
||||
"Sorted Newest First": 3,
|
||||
"Sorted Oldest First": 3,
|
||||
"Sorted Title": 3,
|
||||
"Test Album": 1,
|
||||
}
|
||||
|
||||
ALBUM_PHOTO_UUID_DICT = {
|
||||
"Pumpkin Farm": [
|
||||
@@ -58,10 +106,33 @@ ALBUM_PHOTO_UUID_DICT = {
|
||||
}
|
||||
|
||||
UUID_DICT = {
|
||||
"two_albums": "F12384F6-CD17-4151-ACBA-AE0E3688539E",
|
||||
"six_albums": "F12384F6-CD17-4151-ACBA-AE0E3688539E",
|
||||
"album_dates": "0C514A98-7B77-4E4F-801B-364B7B65EAFA",
|
||||
}
|
||||
|
||||
UUID_DICT_SORT_ORDER = {
|
||||
AlbumSortOrder.MANUAL: [
|
||||
"7783E8E6-9CAC-40F3-BE22-81FB7051C266",
|
||||
"3DD2C897-F19E-4CA6-8C22-B027D5A71907",
|
||||
"F12384F6-CD17-4151-ACBA-AE0E3688539E",
|
||||
],
|
||||
AlbumSortOrder.NEWEST_FIRST: [
|
||||
"7783E8E6-9CAC-40F3-BE22-81FB7051C266",
|
||||
"F12384F6-CD17-4151-ACBA-AE0E3688539E",
|
||||
"3DD2C897-F19E-4CA6-8C22-B027D5A71907",
|
||||
],
|
||||
AlbumSortOrder.OLDEST_FIRST: [
|
||||
"3DD2C897-F19E-4CA6-8C22-B027D5A71907",
|
||||
"F12384F6-CD17-4151-ACBA-AE0E3688539E",
|
||||
"7783E8E6-9CAC-40F3-BE22-81FB7051C266",
|
||||
],
|
||||
AlbumSortOrder.TITLE: [
|
||||
"7783E8E6-9CAC-40F3-BE22-81FB7051C266",
|
||||
"F12384F6-CD17-4151-ACBA-AE0E3688539E",
|
||||
"3DD2C897-F19E-4CA6-8C22-B027D5A71907",
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def photosdb():
|
||||
@@ -186,8 +257,9 @@ def test_albums_photos(photosdb):
|
||||
photos = album.photos
|
||||
assert len(photos) == ALBUM_LEN_DICT[album.title]
|
||||
assert len(photos) == len(album)
|
||||
for photo in photos:
|
||||
assert photo.uuid in ALBUM_PHOTO_UUID_DICT[album.title]
|
||||
if album.title in ALBUM_PHOTO_UUID_DICT:
|
||||
for photo in photos:
|
||||
assert photo.uuid in ALBUM_PHOTO_UUID_DICT[album.title]
|
||||
|
||||
|
||||
def test_album_dates(photosdb):
|
||||
@@ -237,19 +309,67 @@ def test_photoinfo_albums(photosdb):
|
||||
|
||||
def test_photoinfo_albums_2(photosdb):
|
||||
"""Test that PhotoInfo.albums returns only number albums expected"""
|
||||
photos = photosdb.photos(uuid=[UUID_DICT["two_albums"]])
|
||||
photos = photosdb.photos(uuid=[UUID_DICT["six_albums"]])
|
||||
|
||||
albums = photos[0].albums
|
||||
assert len(albums) == 2
|
||||
assert len(albums) == 6
|
||||
|
||||
|
||||
def test_photoinfo_album_info(photosdb):
|
||||
"""test PhotoInfo.album_info"""
|
||||
photos = photosdb.photos(uuid=[UUID_DICT["two_albums"]])
|
||||
photos = photosdb.photos(uuid=[UUID_DICT["six_albums"]])
|
||||
|
||||
album_info = photos[0].album_info
|
||||
assert len(album_info) == 2
|
||||
assert album_info[0].title in ["Pumpkin Farm", "Test Album"]
|
||||
assert album_info[1].title in ["Pumpkin Farm", "Test Album"]
|
||||
assert len(album_info) == 6
|
||||
assert album_info[0].title in [
|
||||
"Pumpkin Farm",
|
||||
"Test Album",
|
||||
"Sorted Manual",
|
||||
"Sorted Newest First",
|
||||
"Sorted Oldest First",
|
||||
"Sorted Title",
|
||||
]
|
||||
assert album_info[1].title in [
|
||||
"Pumpkin Farm",
|
||||
"Test Album",
|
||||
"Sorted Manual",
|
||||
"Sorted Newest First",
|
||||
"Sorted Oldest First",
|
||||
"Sorted Title",
|
||||
]
|
||||
|
||||
assert photos[0].uuid in [photo.uuid for photo in album_info[0].photos]
|
||||
|
||||
|
||||
def test_album_sort_order(photosdb):
|
||||
"""Test that AlbumInfo.sort_order is set correctly"""
|
||||
albums = photosdb.album_info
|
||||
|
||||
for album in albums:
|
||||
if album.title == "Sorted Manual":
|
||||
assert album.sort_order == AlbumSortOrder.MANUAL
|
||||
elif album.title == "Sorted Newest First":
|
||||
assert album.sort_order == AlbumSortOrder.NEWEST_FIRST
|
||||
elif album.title == "Sorted Oldest First":
|
||||
assert album.sort_order == AlbumSortOrder.OLDEST_FIRST
|
||||
elif album.title == "Sorted Title":
|
||||
assert album.sort_order == AlbumSortOrder.TITLE
|
||||
|
||||
|
||||
def test_album_sort_order_photos(photosdb):
|
||||
"""Test AlbumInfo.photos returns photos sorted according to AlbumInfo.sort_order"""
|
||||
albums = photosdb.album_info
|
||||
for album in albums:
|
||||
uuids = [photo.uuid for photo in album.photos]
|
||||
if album.title == "Sorted Manual":
|
||||
assert album.sort_order == AlbumSortOrder.MANUAL
|
||||
assert uuids == UUID_DICT_SORT_ORDER[AlbumSortOrder.MANUAL]
|
||||
if album.title == "Sorted Newest First":
|
||||
assert album.sort_order == AlbumSortOrder.NEWEST_FIRST
|
||||
assert uuids == UUID_DICT_SORT_ORDER[AlbumSortOrder.NEWEST_FIRST]
|
||||
if album.title == "Sorted Oldest First":
|
||||
assert album.sort_order == AlbumSortOrder.OLDEST_FIRST
|
||||
assert uuids == UUID_DICT_SORT_ORDER[AlbumSortOrder.OLDEST_FIRST]
|
||||
if album.title == "Sorted Title":
|
||||
assert album.sort_order == AlbumSortOrder.TITLE
|
||||
assert uuids == UUID_DICT_SORT_ORDER[AlbumSortOrder.TITLE]
|
||||
@@ -49,45 +49,53 @@ KEYWORDS = [
|
||||
# Photos 5 includes blank person for detected face
|
||||
PERSONS = ["Katie", "Suzy", "Maria", _UNKNOWN_PERSON]
|
||||
ALBUMS = [
|
||||
"Pumpkin Farm",
|
||||
"Test Album", # there are 2 albums named "Test Album" for testing duplicate album names
|
||||
"AlbumInFolder",
|
||||
"Raw",
|
||||
"I have a deleted twin", # there's an empty album with same name that has been deleted
|
||||
"EmptyAlbum",
|
||||
"2018-10 - Sponsion, Museum, Frühstück, Römermuseum",
|
||||
"2019-10/11 Paris Clermont",
|
||||
"AlbumInFolder",
|
||||
"EmptyAlbum",
|
||||
"I have a deleted twin", # there's an empty album with same name that has been deleted
|
||||
"Multi Keyword",
|
||||
"Pumpkin Farm",
|
||||
"Raw",
|
||||
"Sorted Manual",
|
||||
"Sorted Newest First",
|
||||
"Sorted Oldest First",
|
||||
"Sorted Title",
|
||||
"Test Album", # there are 2 albums named "Test Album" for testing duplicate album names
|
||||
]
|
||||
KEYWORDS_DICT = {
|
||||
"Kids": 4,
|
||||
"wedding": 3,
|
||||
"flowers": 1,
|
||||
"Drink": 2,
|
||||
"England": 1,
|
||||
"London": 1,
|
||||
"Kids": 4,
|
||||
"London 2018": 1,
|
||||
"London": 1,
|
||||
"Maria": 1,
|
||||
"St. James's Park": 1,
|
||||
"Travel": 2,
|
||||
"UK": 1,
|
||||
"United Kingdom": 1,
|
||||
"foo/bar": 1,
|
||||
"Travel": 2,
|
||||
"Maria": 1,
|
||||
"Drink": 2,
|
||||
"Val d'Isère": 2,
|
||||
"Wine": 2,
|
||||
"Wine Bottle": 2,
|
||||
"Wine": 2,
|
||||
"flowers": 1,
|
||||
"foo/bar": 1,
|
||||
"wedding": 3,
|
||||
}
|
||||
PERSONS_DICT = {"Katie": 3, "Suzy": 2, "Maria": 2, _UNKNOWN_PERSON: 1}
|
||||
ALBUM_DICT = {
|
||||
"Pumpkin Farm": 3,
|
||||
"Test Album": 2,
|
||||
"AlbumInFolder": 2,
|
||||
"Raw": 4,
|
||||
"I have a deleted twin": 1,
|
||||
"EmptyAlbum": 0,
|
||||
"2018-10 - Sponsion, Museum, Frühstück, Römermuseum": 1,
|
||||
"2019-10/11 Paris Clermont": 1,
|
||||
"AlbumInFolder": 2,
|
||||
"EmptyAlbum": 0,
|
||||
"I have a deleted twin": 1,
|
||||
"Multi Keyword": 2,
|
||||
"Pumpkin Farm": 3,
|
||||
"Raw": 4,
|
||||
"Sorted Manual": 3,
|
||||
"Sorted Newest First": 3,
|
||||
"Sorted Oldest First": 3,
|
||||
"Sorted Title": 3,
|
||||
"Test Album": 2,
|
||||
} # Note: there are 2 albums named "Test Album" for testing duplicate album names
|
||||
|
||||
UUID_DICT = {
|
||||
|
||||
@@ -754,11 +754,11 @@ UUID_IN_ALBUM = [
|
||||
"4D521201-92AC-43E5-8F7C-59BC41C37A96",
|
||||
"D05A5FE3-15FB-49A1-A15D-AB3DA6F8B068",
|
||||
"3DD2C897-F19E-4CA6-8C22-B027D5A71907",
|
||||
"7783E8E6-9CAC-40F3-BE22-81FB7051C266",
|
||||
]
|
||||
|
||||
UUID_NOT_IN_ALBUM = [
|
||||
"A1DD1F98-2ECD-431F-9AC9-5AFEFE2D3A5C",
|
||||
"7783E8E6-9CAC-40F3-BE22-81FB7051C266",
|
||||
"DC99FBDD-7A52-4100-A5BB-344131646C30",
|
||||
"D1359D09-1373-4F3B-B0E3-1A4DE573E4A3",
|
||||
"E2078879-A29C-4D6F-BACB-E3BBE6C3EB91",
|
||||
@@ -2649,7 +2649,7 @@ def test_query_label_4():
|
||||
)
|
||||
assert result.exit_code == 0
|
||||
json_got = json.loads(result.output)
|
||||
assert len(json_got) == 2
|
||||
assert len(json_got) == 1
|
||||
|
||||
|
||||
def test_query_deleted_deleted_only():
|
||||
@@ -2883,11 +2883,11 @@ def test_export_sidecar_templates():
|
||||
exifdata = json.load(jsonfile)
|
||||
assert (
|
||||
exifdata[0]["XMP:Description"]
|
||||
== "Girls with pumpkins Katie, Suzy Kids Pumpkin Farm, Test Album"
|
||||
== "Girls with pumpkins Katie, Suzy Kids Pumpkin Farm, Sorted Manual, Sorted Newest First, Sorted Oldest First, Sorted Title, Test Album"
|
||||
)
|
||||
assert (
|
||||
exifdata[0]["EXIF:ImageDescription"]
|
||||
== "Girls with pumpkins Katie, Suzy Kids Pumpkin Farm, Test Album"
|
||||
== "Girls with pumpkins Katie, Suzy Kids Pumpkin Farm, Sorted Manual, Sorted Newest First, Sorted Oldest First, Sorted Title, Test Album"
|
||||
)
|
||||
|
||||
|
||||
@@ -2926,11 +2926,11 @@ def test_export_sidecar_templates_exiftool():
|
||||
exifdata = json.load(jsonfile)
|
||||
assert (
|
||||
exifdata[0]["Description"]
|
||||
== "Girls with pumpkins Katie, Suzy Kids Pumpkin Farm, Test Album"
|
||||
== "Girls with pumpkins Katie, Suzy Kids Pumpkin Farm, Sorted Manual, Sorted Newest First, Sorted Oldest First, Sorted Title, Test Album"
|
||||
)
|
||||
assert (
|
||||
exifdata[0]["ImageDescription"]
|
||||
== "Girls with pumpkins Katie, Suzy Kids Pumpkin Farm, Test Album"
|
||||
== "Girls with pumpkins Katie, Suzy Kids Pumpkin Farm, Sorted Manual, Sorted Newest First, Sorted Oldest First, Sorted Title, Test Album"
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user