Add fallback if checksum updatedAt is missing

This commit is contained in:
croneter 2018-11-07 07:45:19 +01:00
parent 009fc9937a
commit 923c413921
2 changed files with 6 additions and 3 deletions

View file

@ -48,7 +48,8 @@ class FullSync(common.libsync_mixin):
plex_id = int(xml_item.get('ratingKey'))
if not self.repair and self.plexdb.checksum(plex_id, self.plex_type) == \
int('%s%s' % (plex_id,
xml_item.get('updatedAt'))):
xml_item.get('updatedAt',
xml_item.get('addedAt', 1541572987)))):
# Already got EXACTLY this item in our DB
self.plexdb.update_last_sync(plex_id,
self.plex_type,

View file

@ -101,8 +101,10 @@ class API(object):
Returns the unique int <ratingKey><updatedAt> or None if this failes
"""
try:
return cast(int, '%s%s' % (self.item.get('ratingKey'),
self.item.get('updatedAt')))
return int('%s%s' % (self.item.get('ratingKey'),
self.item.get('updatedAt',
self.item.get('addedAt',
1541572987))))
except ValueError:
pass