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 #we have to compare the lists somehow
for item in episodeData: 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")) comparestring1 = str(item.get("ParentIndexNumber")) + "-" + str(item.get("IndexNumber"))
matchFound = False matchFound = False
progMessage = "Processing" progMessage = "Processing"
@ -169,8 +168,8 @@ class LibrarySync():
if(pDialog != None): if(pDialog != None):
percentage = int(((float(count) / float(total)) * 100)) percentage = int(((float(count) / float(total)) * 100))
pDialog.update(percentage, message=progMessage + " Episode: " + str(count)) pDialog.update(percentage, message=progMessage + " Episode: " + str(count))
count += 1 count += 1
# process deletes # process deletes
# TODO --> process deletes for episodes !!! # TODO --> process deletes for episodes !!!
if(pDialog != None): if(pDialog != None):
@ -201,10 +200,10 @@ class LibrarySync():
return False return False
if cleanNeeded: if cleanNeeded:
xbmc.executebuiltin("CleanLibrary(video)") WINDOW.setProperty("cleanNeeded", "true")
if updateNeeded: if updateNeeded:
xbmc.executebuiltin("UpdateLibrary(video)") WINDOW.setProperty("updateNeeded", "true")
finally: finally:
WINDOW.clearProperty("librarysync") WINDOW.clearProperty("librarysync")
@ -263,7 +262,7 @@ class LibrarySync():
percentage = int(((float(count) / float(totalCount)) * 100)) percentage = int(((float(count) / float(totalCount)) * 100))
pDialog.update(percentage, message="Updating Movie: " + str(count)) pDialog.update(percentage, message="Updating Movie: " + str(count))
count += 1 count += 1
#process Tv shows #process Tv shows
tvshowData = self.getTVShows(False) tvshowData = self.getTVShows(False)
@ -303,7 +302,7 @@ class LibrarySync():
if(pDialog != None): if(pDialog != None):
percentage = int(((float(count) / float(totalCount)) * 100)) percentage = int(((float(count) / float(totalCount)) * 100))
pDialog.update(percentage, message="Updating Episode: " + str(count)) pDialog.update(percentage, message="Updating Episode: " + str(count))
count += 1 count += 1
finally: finally:
WINDOW.clearProperty("librarysync") WINDOW.clearProperty("librarysync")

View file

@ -6,14 +6,11 @@ import threading
import json import json
from datetime import datetime from datetime import datetime
addonSettings = xbmcaddon.Addon(id='plugin.video.mb3sync') addonSettings = xbmcaddon.Addon(id='plugin.video.mb3sync')
cwd = addonSettings.getAddonInfo('path') cwd = addonSettings.getAddonInfo('path')
BASE_RESOURCE_PATH = xbmc.translatePath( os.path.join( cwd, 'resources', 'lib' ) ) BASE_RESOURCE_PATH = xbmc.translatePath( os.path.join( cwd, 'resources', 'lib' ) )
sys.path.append(BASE_RESOURCE_PATH) sys.path.append(BASE_RESOURCE_PATH)
WINDOW = xbmcgui.Window( 10000 )
import KodiMonitor import KodiMonitor
import Utils as utils import Utils as utils
from LibrarySync import LibrarySync from LibrarySync import LibrarySync
@ -105,6 +102,17 @@ class Service():
cur_seconds_incrsync = interval_IncrementalSync - 10 cur_seconds_incrsync = interval_IncrementalSync - 10
else: else:
cur_seconds_incrsync += 1 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: else:
xbmc.log("Not authenticated yet") xbmc.log("Not authenticated yet")