Fixed #451, path_derivatives for Photos version <= 4

This commit is contained in:
Rhet Turnbull 2021-05-23 09:34:40 -07:00
parent 96037508c1
commit 7cde52bf9b
3 changed files with 20 additions and 2 deletions

View File

@ -1,3 +1,3 @@
""" version info """
__version__ = "0.42.22"
__version__ = "0.42.23"

View File

@ -838,7 +838,7 @@ class PhotoInfo:
def _path_derivatives_4(self):
""" Return paths to all derivative (preview) files for Photos <= 4"""
modelid = self._info["masterModelID"]
modelid = self._info["modelID"]
if modelid is None:
return []
folder_id, file_id = _get_resource_loc(modelid)

View File

@ -30,6 +30,8 @@ KEYWORDS_DICT = {
PERSONS_DICT = {"Katie": 3, "Suzy": 2, "Maria": 1, _UNKNOWN_PERSON: 1}
ALBUM_DICT = {"Pumpkin Farm": 3, "AlbumInFolder": 1}
UUID_DICT = {"derivatives": "FPm+ICxpQV+LPBKR22UepA"}
def test_init():
import osxphotos
@ -162,3 +164,19 @@ def test_keyword_not_in_album():
photos3 = [p for p in photos2 if p not in photos1]
assert len(photos3) == 1
assert photos3[0].uuid == "Pj99JmYjQkeezdY2OFuSaw"
def test_path_derivatives():
# test path_derivatives
import osxphotos
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
photos = photosdb.photos(uuid=[UUID_DICT["derivatives"]])
p = photos[0]
derivs = [
"/resources/proxies/derivatives/00/00/9/UNADJUSTEDRAW_thumb_9.jpg",
"/resources/proxies/derivatives/00/00/9/UNADJUSTEDRAW_mini_9.jpg",
]
for i, p in enumerate(p.path_derivatives):
assert p.endswith(derivs[i])