Add missing method
This commit is contained in:
parent
01fc08b027
commit
3d77bd64d1
2 changed files with 12 additions and 1 deletions
|
@ -81,7 +81,7 @@ class FullSync(backgroundthread.KillableThread, common.libsync_mixin):
|
||||||
if self.plexdb.is_recorded(plex_id, self.plex_type):
|
if self.plexdb.is_recorded(plex_id, self.plex_type):
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
if self.plexdb.check_checksum(
|
if self.plexdb.plex_id_by_checksum(
|
||||||
int('%s%s' % (plex_id,
|
int('%s%s' % (plex_id,
|
||||||
xml_item.get('updatedAt')))):
|
xml_item.get('updatedAt')))):
|
||||||
self.plexdb.update_last_sync(plex_id, self.last_sync)
|
self.plexdb.update_last_sync(plex_id, self.last_sync)
|
||||||
|
|
|
@ -94,6 +94,17 @@ class PlexDBBase(object):
|
||||||
self.cursor.execute(query, (last_sync, ))
|
self.cursor.execute(query, (last_sync, ))
|
||||||
return (x[0] for x in self.cursor)
|
return (x[0] for x in self.cursor)
|
||||||
|
|
||||||
|
def plex_id_by_checksum(self, checksum, plex_type):
|
||||||
|
"""
|
||||||
|
Returns the plex_id for the (unique) checksum or None
|
||||||
|
"""
|
||||||
|
query = 'SELECT plex_id FROM %s WHERE checksum = ?' % plex_type
|
||||||
|
self.cursor.execute(query, (checksum, ))
|
||||||
|
try:
|
||||||
|
return self.cursor.fetchone()[0]
|
||||||
|
except TypeError:
|
||||||
|
pass
|
||||||
|
|
||||||
def update_last_sync(self, plex_type, plex_id, last_sync):
|
def update_last_sync(self, plex_type, plex_id, last_sync):
|
||||||
"""
|
"""
|
||||||
Sets a new timestamp for plex_id
|
Sets a new timestamp for plex_id
|
||||||
|
|
Loading…
Reference in a new issue