From 0906dbe6370922b4c9649350014ed8a21d29c4fd Mon Sep 17 00:00:00 2001 From: Rhet Turnbull Date: Fri, 10 Dec 2021 19:36:25 -0800 Subject: [PATCH] Fixed error for missing photo path, #547 --- osxphotos/_version.py | 2 +- osxphotos/photoinfo/photoinfo.py | 30 +++++++++++------------------- 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/osxphotos/_version.py b/osxphotos/_version.py index 787e76bc..001f7607 100644 --- a/osxphotos/_version.py +++ b/osxphotos/_version.py @@ -1,3 +1,3 @@ """ version info """ -__version__ = "0.43.5" +__version__ = "0.43.6" diff --git a/osxphotos/photoinfo/photoinfo.py b/osxphotos/photoinfo/photoinfo.py index ff995860..88b6a613 100644 --- a/osxphotos/photoinfo/photoinfo.py +++ b/osxphotos/photoinfo/photoinfo.py @@ -856,7 +856,7 @@ class PhotoInfo: if self._db._db_version <= _PHOTOS_4_VERSION: if self.live_photo and not self.ismissing: live_model_id = self._info["live_model_id"] - if live_model_id == None: + if live_model_id is None: logging.debug(f"missing live_model_id: {self._uuid}") photopath = None else: @@ -877,28 +877,20 @@ class PhotoInfo: # photos 4 has "isOnDisk" column we could check # or could do the actual check with "isfile" # TODO: should this be a warning or debug? - logging.debug( - f"MISSING PATH: live photo path for UUID {self._uuid} should be at {photopath} but does not appear to exist" - ) photopath = None else: photopath = None - else: - # Photos 5 - if self.live_photo and not self.ismissing: - filename = pathlib.Path(self.path) - photopath = filename.parent.joinpath(f"{filename.stem}_3.mov") - photopath = str(photopath) - if not os.path.isfile(photopath): - # In testing, I've seen occasional missing movie for live photo - # these appear to be valid -- e.g. video component not yet downloaded from iCloud - # TODO: should this be a warning or debug? - logging.debug( - f"MISSING PATH: live photo path for UUID {self._uuid} should be at {photopath} but does not appear to exist" - ) - photopath = None - else: + elif self.live_photo and self.path and not self.ismissing: + filename = pathlib.Path(self.path) + photopath = filename.parent.joinpath(f"{filename.stem}_3.mov") + photopath = str(photopath) + if not os.path.isfile(photopath): + # In testing, I've seen occasional missing movie for live photo + # these appear to be valid -- e.g. video component not yet downloaded from iCloud + # TODO: should this be a warning or debug? photopath = None + else: + photopath = None return photopath