Improve the checking of an item's checksum
This commit is contained in:
parent
8c3764e8ad
commit
ce002a0fa8
2 changed files with 6 additions and 6 deletions
|
@ -81,9 +81,9 @@ class FullSync(backgroundthread.KillableThread, common.libsync_mixin):
|
|||
if self.plexdb.is_recorded(plex_id, self.plex_type):
|
||||
return
|
||||
else:
|
||||
if self.plexdb.plex_id_by_checksum(
|
||||
if self.plexdb.checksum(plex_id, self.plex_type) == \
|
||||
int('%s%s' % (plex_id,
|
||||
xml_item.get('updatedAt')))):
|
||||
xml_item.get('updatedAt'))):
|
||||
self.plexdb.update_last_sync(plex_id, self.last_sync)
|
||||
return
|
||||
task = GetMetadataTask()
|
||||
|
|
|
@ -94,12 +94,12 @@ class PlexDBBase(object):
|
|||
self.cursor.execute(query, (last_sync, ))
|
||||
return (x[0] for x in self.cursor)
|
||||
|
||||
def plex_id_by_checksum(self, checksum, plex_type):
|
||||
def checksum(self, plex_id, plex_type):
|
||||
"""
|
||||
Returns the plex_id for the (unique) checksum or None
|
||||
Returns the checksum for plex_id
|
||||
"""
|
||||
query = 'SELECT plex_id FROM %s WHERE checksum = ?' % plex_type
|
||||
self.cursor.execute(query, (checksum, ))
|
||||
query = 'SELECT checksum FROM %s WHERE plex_id = ?' % plex_type
|
||||
self.cursor.execute(query, (plex_id, ))
|
||||
try:
|
||||
return self.cursor.fetchone()[0]
|
||||
except TypeError:
|
||||
|
|
Loading…
Reference in a new issue