Bug fixes for path_live_photo and lastmodifieddate
This commit is contained in:
@@ -437,6 +437,7 @@ class PhotoInfo:
|
|||||||
if self.live_photo and not self.ismissing:
|
if self.live_photo and not self.ismissing:
|
||||||
filename = pathlib.Path(self.path)
|
filename = pathlib.Path(self.path)
|
||||||
photopath = filename.parent.joinpath(f"{filename.stem}_3.mov")
|
photopath = filename.parent.joinpath(f"{filename.stem}_3.mov")
|
||||||
|
photopath = str(photopath)
|
||||||
if not os.path.isfile(photopath):
|
if not os.path.isfile(photopath):
|
||||||
# In testing, I've seen occasional missing movie for live photo
|
# 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
|
# these appear to be valid -- e.g. video component not yet downloaded from iCloud
|
||||||
@@ -680,7 +681,9 @@ class PhotoInfo:
|
|||||||
""" string representation of PhotoInfo object """
|
""" string representation of PhotoInfo object """
|
||||||
|
|
||||||
date_iso = self.date.isoformat()
|
date_iso = self.date.isoformat()
|
||||||
date_modified_iso = self.date_modified.isoformat() if self.date_modified else None
|
date_modified_iso = (
|
||||||
|
self.date_modified.isoformat() if self.date_modified else None
|
||||||
|
)
|
||||||
|
|
||||||
info = {
|
info = {
|
||||||
"uuid": self.uuid,
|
"uuid": self.uuid,
|
||||||
@@ -717,7 +720,9 @@ class PhotoInfo:
|
|||||||
def json(self):
|
def json(self):
|
||||||
""" return JSON representation """
|
""" return JSON representation """
|
||||||
|
|
||||||
date_modified_iso = self.date_modified.isoformat() if self.date_modified else None
|
date_modified_iso = (
|
||||||
|
self.date_modified.isoformat() if self.date_modified else None
|
||||||
|
)
|
||||||
|
|
||||||
pic = {
|
pic = {
|
||||||
"uuid": self.uuid,
|
"uuid": self.uuid,
|
||||||
|
|||||||
@@ -532,9 +532,17 @@ class PhotosDB:
|
|||||||
self._dbphotos[uuid]["modelID"] = row[1]
|
self._dbphotos[uuid]["modelID"] = row[1]
|
||||||
self._dbphotos[uuid]["masterUuid"] = row[2]
|
self._dbphotos[uuid]["masterUuid"] = row[2]
|
||||||
self._dbphotos[uuid]["filename"] = row[3]
|
self._dbphotos[uuid]["filename"] = row[3]
|
||||||
self._dbphotos[uuid]["lastmodifieddate"] = (
|
|
||||||
datetime.fromtimestamp(row[4] + td) if row[4] is not None else None
|
# There are sometimes negative values for lastmodifieddate in the database
|
||||||
)
|
# I don't know what these mean but they will raise exception in datetime if
|
||||||
|
# not accounted for
|
||||||
|
if row[4] is not None and row[4] >= 0:
|
||||||
|
self._dbphotos[uuid]["lastmodifieddate"] = datetime.fromtimestamp(
|
||||||
|
row[4] + td
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
self._dbphotos[uuid]["lastmodifieddate"] = None
|
||||||
|
|
||||||
self._dbphotos[uuid]["imageDate"] = datetime.fromtimestamp(row[5] + td)
|
self._dbphotos[uuid]["imageDate"] = datetime.fromtimestamp(row[5] + td)
|
||||||
self._dbphotos[uuid]["mainRating"] = row[6]
|
self._dbphotos[uuid]["mainRating"] = row[6]
|
||||||
self._dbphotos[uuid]["hasAdjustments"] = row[7]
|
self._dbphotos[uuid]["hasAdjustments"] = row[7]
|
||||||
@@ -998,9 +1006,15 @@ class PhotosDB:
|
|||||||
info["masterUuid"] = None
|
info["masterUuid"] = None
|
||||||
info["masterFingerprint"] = row[1]
|
info["masterFingerprint"] = row[1]
|
||||||
info["name"] = row[2]
|
info["name"] = row[2]
|
||||||
info["lastmodifieddate"] = (
|
|
||||||
datetime.fromtimestamp(row[4] + td) if row[4] is not None else None
|
# There are sometimes negative values for lastmodifieddate in the database
|
||||||
)
|
# I don't know what these mean but they will raise exception in datetime if
|
||||||
|
# not accounted for
|
||||||
|
if row[4] is not None and row[4] >= 0:
|
||||||
|
info["lastmodifieddate"] = datetime.fromtimestamp(row[4] + td)
|
||||||
|
else:
|
||||||
|
info["lastmodifieddate"] = None
|
||||||
|
|
||||||
info["imageDate"] = datetime.fromtimestamp(row[5] + td)
|
info["imageDate"] = datetime.fromtimestamp(row[5] + td)
|
||||||
info["imageTimeZoneOffsetSeconds"] = row[6]
|
info["imageTimeZoneOffsetSeconds"] = row[6]
|
||||||
info["hidden"] = row[9]
|
info["hidden"] = row[9]
|
||||||
|
|||||||
Reference in New Issue
Block a user