Ensure that fanart sync closes DB connection during playback
This commit is contained in:
parent
789b214b50
commit
5c7968abdb
1 changed files with 18 additions and 11 deletions
|
@ -44,17 +44,24 @@ class FanartThread(backgroundthread.KillableThread):
|
||||||
|
|
||||||
def _run_internal(self):
|
def _run_internal(self):
|
||||||
LOG.info('Starting FanartThread')
|
LOG.info('Starting FanartThread')
|
||||||
with PlexDB() as plexdb:
|
while True:
|
||||||
func = plexdb.every_plex_id if self.refresh else plexdb.missing_fanart
|
with PlexDB() as plexdb:
|
||||||
for typus in SUPPORTED_TYPES:
|
func = plexdb.every_plex_id if self.refresh else plexdb.missing_fanart
|
||||||
for plex_id in func(typus):
|
for typus in SUPPORTED_TYPES:
|
||||||
if self.isCanceled():
|
for plex_id in func(typus):
|
||||||
return
|
if self.isCanceled() or self.isSuspended():
|
||||||
if self.isSuspended():
|
break
|
||||||
if self.isCanceled():
|
process_fanart(plex_id, typus, self.refresh)
|
||||||
return
|
else:
|
||||||
xbmc.sleep(1000)
|
# Done processing!
|
||||||
process_fanart(plex_id, typus, self.refresh)
|
break
|
||||||
|
# Need to have these outside our DB context to close the connection
|
||||||
|
if self.isCanceled():
|
||||||
|
return
|
||||||
|
if self.isSuspended():
|
||||||
|
if self.isCanceled():
|
||||||
|
return
|
||||||
|
xbmc.sleep(1000)
|
||||||
LOG.info('FanartThread finished')
|
LOG.info('FanartThread finished')
|
||||||
self.callback()
|
self.callback()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue