More fixes

This commit is contained in:
croneter 2018-11-11 19:22:32 +01:00
parent bc7fc4db1b
commit ead799d38b
3 changed files with 8 additions and 1 deletions

View file

@ -80,6 +80,9 @@ class ItemBase(object):
self.plexconn.commit() self.plexconn.commit()
self.artconn.commit() self.artconn.commit()
self.kodiconn.commit() self.kodiconn.commit()
self.plexconn.execute('PRAGMA wal_checkpoint(TRUNCATE);')
self.artconn.execute('PRAGMA wal_checkpoint(TRUNCATE);')
self.kodiconn.execute('PRAGMA wal_checkpoint(TRUNCATE);')
def set_fanart(self, artworks, kodi_id, kodi_type): def set_fanart(self, artworks, kodi_id, kodi_type):
""" """

View file

@ -249,6 +249,10 @@ def initialize():
kodi_type TEXT, kodi_type TEXT,
kodi_hash TEXT) kodi_hash TEXT)
''') ''')
# DB indicees for faster lookups
plexdb.cursor.execute('CREATE UNIQUE INDEX IF NOT EXISTS ix_show_1 ON show (plex_id)')
plexdb.cursor.execute('CREATE UNIQUE INDEX IF NOT EXISTS ix_season_1 ON season (plex_id)')
plexdb.cursor.execute('CREATE UNIQUE INDEX IF NOT EXISTS ix_episode_1 ON episode (plex_id)')
def wipe(): def wipe():

View file

@ -618,7 +618,7 @@ class DownloadGen(object):
child = self.xml[0] child = self.xml[0]
self.xml.remove(child) self.xml.remove(child)
if (self.current % CONTAINERSIZE == 0 and if (self.current % CONTAINERSIZE == 0 and
self.current < self.total - self.cache_factor * CONTAINERSIZE): self.current < self.total - (self.cache_factor - 1) * CONTAINERSIZE):
self.pending_counter.append(None) self.pending_counter.append(None)
self._download_chunk( self._download_chunk(
start=self.current + (self.cache_factor - 1) * CONTAINERSIZE) start=self.current + (self.cache_factor - 1) * CONTAINERSIZE)