dont do a lib scan or clean until the sync is full done

This commit is contained in:
faush01 2015-03-16 16:27:23 +11:00
parent 46f2a3ffdb
commit 9c98f713e7
2 changed files with 17 additions and 10 deletions

View file

@ -140,7 +140,6 @@ class LibrarySync():
#we have to compare the lists somehow
for item in episodeData:
#xbmc.sleep(150) # sleep to not overload system --> can this be replaced by moving the sync to a different thread ?
comparestring1 = str(item.get("ParentIndexNumber")) + "-" + str(item.get("IndexNumber"))
matchFound = False
progMessage = "Processing"
@ -169,8 +168,8 @@ class LibrarySync():
if(pDialog != None):
percentage = int(((float(count) / float(total)) * 100))
pDialog.update(percentage, message=progMessage + " Episode: " + str(count))
count += 1
count += 1
# process deletes
# TODO --> process deletes for episodes !!!
if(pDialog != None):
@ -201,10 +200,10 @@ class LibrarySync():
return False
if cleanNeeded:
xbmc.executebuiltin("CleanLibrary(video)")
WINDOW.setProperty("cleanNeeded", "true")
if updateNeeded:
xbmc.executebuiltin("UpdateLibrary(video)")
WINDOW.setProperty("updateNeeded", "true")
finally:
WINDOW.clearProperty("librarysync")
@ -263,7 +262,7 @@ class LibrarySync():
percentage = int(((float(count) / float(totalCount)) * 100))
pDialog.update(percentage, message="Updating Movie: " + str(count))
count += 1
#process Tv shows
tvshowData = self.getTVShows(False)
@ -303,7 +302,7 @@ class LibrarySync():
if(pDialog != None):
percentage = int(((float(count) / float(totalCount)) * 100))
pDialog.update(percentage, message="Updating Episode: " + str(count))
count += 1
count += 1
finally:
WINDOW.clearProperty("librarysync")

View file

@ -6,14 +6,11 @@ import threading
import json
from datetime import datetime
addonSettings = xbmcaddon.Addon(id='plugin.video.mb3sync')
cwd = addonSettings.getAddonInfo('path')
BASE_RESOURCE_PATH = xbmc.translatePath( os.path.join( cwd, 'resources', 'lib' ) )
sys.path.append(BASE_RESOURCE_PATH)
WINDOW = xbmcgui.Window( 10000 )
import KodiMonitor
import Utils as utils
from LibrarySync import LibrarySync
@ -105,6 +102,17 @@ class Service():
cur_seconds_incrsync = interval_IncrementalSync - 10
else:
cur_seconds_incrsync += 1
# check if we need to run lib updates
WINDOW = xbmcgui.Window( 10000 )
if(WINDOW.getProperty("cleanNeeded") == "true"):
xbmc.executebuiltin("CleanLibrary(video)")
WINDOW.clearProperty("cleanNeeded")
if(WINDOW.getProperty("updateNeeded") == "true"):
xbmc.executebuiltin("UpdateLibrary(video)")
WINDOW.clearProperty("updateNeeded")
else:
xbmc.log("Not authenticated yet")