Hot fix for null date, #1014
This commit is contained in:
@@ -1042,9 +1042,8 @@ class PhotosDB:
|
|||||||
self._dbphotos[uuid]["lastmodifieddate"] = datetime.fromtimestamp(
|
self._dbphotos[uuid]["lastmodifieddate"] = datetime.fromtimestamp(
|
||||||
row[4] + TIME_DELTA
|
row[4] + TIME_DELTA
|
||||||
)
|
)
|
||||||
except ValueError:
|
except (ValueError, TypeError):
|
||||||
self._dbphotos[uuid]["lastmodifieddate"] = None
|
# sometimes the date is invalid or null
|
||||||
except TypeError:
|
|
||||||
self._dbphotos[uuid]["lastmodifieddate"] = None
|
self._dbphotos[uuid]["lastmodifieddate"] = None
|
||||||
|
|
||||||
self._dbphotos[uuid]["imageTimeZoneOffsetSeconds"] = row[9]
|
self._dbphotos[uuid]["imageTimeZoneOffsetSeconds"] = row[9]
|
||||||
@@ -1056,8 +1055,8 @@ class PhotosDB:
|
|||||||
delta = timedelta(seconds=seconds)
|
delta = timedelta(seconds=seconds)
|
||||||
tz = timezone(delta)
|
tz = timezone(delta)
|
||||||
self._dbphotos[uuid]["imageDate"] = imagedate.astimezone(tz=tz)
|
self._dbphotos[uuid]["imageDate"] = imagedate.astimezone(tz=tz)
|
||||||
except ValueError:
|
except (ValueError, TypeError):
|
||||||
# sometimes imageDate is invalid so use 1 Jan 1970 in UTC as image date
|
# sometimes imageDate is invalid so use 1 Jan 1970 as image date
|
||||||
imagedate = datetime(1970, 1, 1)
|
imagedate = datetime(1970, 1, 1)
|
||||||
tz = timezone(timedelta(0))
|
tz = timezone(timedelta(0))
|
||||||
self._dbphotos[uuid]["imageDate"] = imagedate.astimezone(tz=tz)
|
self._dbphotos[uuid]["imageDate"] = imagedate.astimezone(tz=tz)
|
||||||
@@ -2019,8 +2018,8 @@ class PhotosDB:
|
|||||||
delta = timedelta(seconds=seconds)
|
delta = timedelta(seconds=seconds)
|
||||||
tz = timezone(delta)
|
tz = timezone(delta)
|
||||||
info["imageDate"] = imagedate.astimezone(tz=tz)
|
info["imageDate"] = imagedate.astimezone(tz=tz)
|
||||||
except ValueError:
|
except (ValueError, TypeError):
|
||||||
# sometimes imageDate is invalid so use 1 Jan 1970 in UTC as image date
|
# sometimes imageDate is invalid or null so use 1 Jan 1970 in UTC as image date (#1014)
|
||||||
imagedate = datetime(1970, 1, 1)
|
imagedate = datetime(1970, 1, 1)
|
||||||
tz = timezone(timedelta(0))
|
tz = timezone(timedelta(0))
|
||||||
info["imageDate"] = imagedate.astimezone(tz=tz)
|
info["imageDate"] = imagedate.astimezone(tz=tz)
|
||||||
@@ -2602,8 +2601,8 @@ class PhotosDB:
|
|||||||
# save raw time stamp valu
|
# save raw time stamp valu
|
||||||
moment_info[date_name + "_timestamp"] = moment_info[date_name]
|
moment_info[date_name + "_timestamp"] = moment_info[date_name]
|
||||||
moment_info[date_name] = moment_date.astimezone(tz=tz)
|
moment_info[date_name] = moment_date.astimezone(tz=tz)
|
||||||
except ValueError:
|
except (ValueError, TypeError):
|
||||||
# sometimes imageDate is invalid so use 1 Jan 1970 in UTC as image date
|
# sometimes imageDate is invalid or null so use 1 Jan 1970 in UTC as image date
|
||||||
moment_date = datetime(1970, 1, 1)
|
moment_date = datetime(1970, 1, 1)
|
||||||
tz = timezone(timedelta(0))
|
tz = timezone(timedelta(0))
|
||||||
moment_info[date_name + "_timestamp"] = date_stamp
|
moment_info[date_name + "_timestamp"] = date_stamp
|
||||||
|
|||||||
Reference in New Issue
Block a user