only set the first run setting if it is not set

This commit is contained in:
shaun 2015-03-25 18:47:22 +11:00
parent 52d4093a44
commit a6a30cc54c
2 changed files with 24 additions and 12 deletions

View file

@ -74,15 +74,17 @@ class LibrarySync():
def MoviesSync(self, fullsync=True): def MoviesSync(self, fullsync=True):
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
WINDOW = xbmcgui.Window( 10000 ) WINDOW = xbmcgui.Window( 10000 )
pDialog = None pDialog = None
startedSync = datetime.today() startedSync = datetime.today()
try: try:
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
dbSyncIndication = addon.getSetting("dbSyncIndication") dbSyncIndication = addon.getSetting("dbSyncIndication")
dbSyncFirstRun = addon.getSetting("SyncFirstMovieRunDone")
if(addon.getSetting("SyncFirstMovieRunDone") != "true" or dbSyncIndication == "Dialog Progress"): if(dbSyncFirstRun != "true" or dbSyncIndication == "Dialog Progress"):
pDialog = xbmcgui.DialogProgress() pDialog = xbmcgui.DialogProgress()
elif(dbSyncIndication == "BG Progress"): elif(dbSyncIndication == "BG Progress"):
pDialog = xbmcgui.DialogProgressBG() pDialog = xbmcgui.DialogProgressBG()
@ -224,7 +226,9 @@ class LibrarySync():
if cleanNeeded: if cleanNeeded:
self.doKodiLibraryUpdate(True, pDialog) self.doKodiLibraryUpdate(True, pDialog)
addon.setSetting("SyncFirstMovieRunDone", "true") if(dbSyncFirstRun != "true"):
addon = xbmcaddon.Addon(id='plugin.video.mb3sync') #force a new instance of the addon
addon.setSetting("SyncFirstMovieRunDone", "true")
# display notification if set up # display notification if set up
notificationString = "" notificationString = ""
@ -263,8 +267,9 @@ class LibrarySync():
try: try:
dbSyncIndication = addon.getSetting("dbSyncIndication") dbSyncIndication = addon.getSetting("dbSyncIndication")
dbSyncFirstRun = addon.getSetting("SyncFirstTVRunDone")
if(addon.getSetting("SyncFirstTVRunDone") != "true" or dbSyncIndication == "Dialog Progress"): if(dbSyncFirstRun != "true" or dbSyncIndication == "Dialog Progress"):
pDialog = xbmcgui.DialogProgress() pDialog = xbmcgui.DialogProgress()
elif(dbSyncIndication == "BG Progress"): elif(dbSyncIndication == "BG Progress"):
pDialog = xbmcgui.DialogProgressBG() pDialog = xbmcgui.DialogProgressBG()
@ -581,7 +586,9 @@ class LibrarySync():
if cleanNeeded: if cleanNeeded:
self.doKodiLibraryUpdate(True, pDialog) self.doKodiLibraryUpdate(True, pDialog)
addon.setSetting("SyncFirstTVRunDone", "true") if(dbSyncFirstRun != "true"):
addon = xbmcaddon.Addon(id='plugin.video.mb3sync') #force a new instance of the addon
addon.setSetting("SyncFirstTVRunDone", "true")
# display notification if set up # display notification if set up
notificationString = "" notificationString = ""
@ -619,8 +626,9 @@ class LibrarySync():
try: try:
dbSyncIndication = addon.getSetting("dbSyncIndication") dbSyncIndication = addon.getSetting("dbSyncIndication")
dbSyncFirstRun = addon.getSetting("SyncFirstMusicVideoRunDone")
if(addon.getSetting("SyncFirstMusicVideoRunDone") != "true" or dbSyncIndication == "Dialog Progress"): if(dbSyncFirstRun != "true" or dbSyncIndication == "Dialog Progress"):
pDialog = xbmcgui.DialogProgress() pDialog = xbmcgui.DialogProgress()
elif(dbSyncIndication == "BG Progress"): elif(dbSyncIndication == "BG Progress"):
pDialog = xbmcgui.DialogProgressBG() pDialog = xbmcgui.DialogProgressBG()
@ -736,7 +744,9 @@ class LibrarySync():
if cleanNeeded: if cleanNeeded:
self.doKodiLibraryUpdate(True, pDialog) self.doKodiLibraryUpdate(True, pDialog)
addon.setSetting("SyncFirstMusicVideoRunDone", "true") if(dbSyncFirstRun != "true"):
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
addon.setSetting("SyncFirstMusicVideoRunDone", "true")
finally: finally:
if(pDialog != None): if(pDialog != None):
@ -768,8 +778,9 @@ class LibrarySync():
try: try:
playCountSyncIndication = addon.getSetting("playCountSyncIndication") playCountSyncIndication = addon.getSetting("playCountSyncIndication")
playCountSyncFirstRun = addon.getSetting("SyncFirstCountsRunDone")
if(addon.getSetting("SyncFirstCountsRunDone") != "true" or playCountSyncIndication == "Dialog Progress"): if(playCountSyncFirstRun != "true" or playCountSyncIndication == "Dialog Progress"):
pDialog = xbmcgui.DialogProgress() pDialog = xbmcgui.DialogProgress()
elif(playCountSyncIndication == "BG Progress"): elif(playCountSyncIndication == "BG Progress"):
pDialog = xbmcgui.DialogProgressBG() pDialog = xbmcgui.DialogProgressBG()
@ -899,8 +910,10 @@ class LibrarySync():
count += 1 count += 1
showCurrent += 1 showCurrent += 1
addon.setSetting("SyncFirstCountsRunDone", "true") if(playCountSyncFirstRun != "true"):
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
addon.setSetting("SyncFirstCountsRunDone", "true")
# display notification if set up # display notification if set up
notificationString = "" notificationString = ""

View file

@ -6,8 +6,7 @@ import threading
import json import json
from datetime import datetime from datetime import datetime
addonSettings = xbmcaddon.Addon(id='plugin.video.mb3sync') cwd = xbmcaddon.Addon(id='plugin.video.mb3sync').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)