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,6 +226,8 @@ class LibrarySync():
if cleanNeeded: if cleanNeeded:
self.doKodiLibraryUpdate(True, pDialog) self.doKodiLibraryUpdate(True, pDialog)
if(dbSyncFirstRun != "true"):
addon = xbmcaddon.Addon(id='plugin.video.mb3sync') #force a new instance of the addon
addon.setSetting("SyncFirstMovieRunDone", "true") addon.setSetting("SyncFirstMovieRunDone", "true")
# display notification if set up # display notification if set up
@ -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,6 +586,8 @@ class LibrarySync():
if cleanNeeded: if cleanNeeded:
self.doKodiLibraryUpdate(True, pDialog) self.doKodiLibraryUpdate(True, pDialog)
if(dbSyncFirstRun != "true"):
addon = xbmcaddon.Addon(id='plugin.video.mb3sync') #force a new instance of the addon
addon.setSetting("SyncFirstTVRunDone", "true") addon.setSetting("SyncFirstTVRunDone", "true")
# display notification if set up # display notification if set up
@ -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,6 +744,8 @@ class LibrarySync():
if cleanNeeded: if cleanNeeded:
self.doKodiLibraryUpdate(True, pDialog) self.doKodiLibraryUpdate(True, pDialog)
if(dbSyncFirstRun != "true"):
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
addon.setSetting("SyncFirstMusicVideoRunDone", "true") addon.setSetting("SyncFirstMusicVideoRunDone", "true")
finally: finally:
@ -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()
@ -900,6 +911,8 @@ class LibrarySync():
showCurrent += 1 showCurrent += 1
if(playCountSyncFirstRun != "true"):
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
addon.setSetting("SyncFirstCountsRunDone", "true") addon.setSetting("SyncFirstCountsRunDone", "true")
# display notification if set up # display notification if set up

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)