From 4cfb8c4610bbb05aa1e2d96b69e3e904da14a22a Mon Sep 17 00:00:00 2001 From: tomkat83 Date: Sun, 11 Sep 2016 17:51:00 +0200 Subject: [PATCH] Fix OperationalError for Kodi DB - Fanart sync is too taxing, needs to be done after regular syncs --- resources/lib/librarysync.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/resources/lib/librarysync.py b/resources/lib/librarysync.py index 0bc25f31..3401ec85 100644 --- a/resources/lib/librarysync.py +++ b/resources/lib/librarysync.py @@ -292,11 +292,20 @@ class ProcessFanartThread(Thread): log.info("---===### Stopped FanartSync ###===---") return xbmc.sleep(1000) + while window('plex_dbScan'): + # Don't do background sync if there is another sync + # going - otherwise we will have OperationalError for + # Kodi DB changes! + if threadStopped(): + # Abort was requested while waiting. We should exit + log.info("---===### Stopped FanartSync ###===---") + return + xbmc.sleep(1000) # grabs Plex item from queue try: item = queue.get(block=False) except Queue.Empty: - xbmc.sleep(50) + xbmc.sleep(200) continue if item['refresh'] is True: # Leave the Plex art untouched