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):
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
WINDOW = xbmcgui.Window( 10000 )
pDialog = None
startedSync = datetime.today()
try:
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
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()
elif(dbSyncIndication == "BG Progress"):
pDialog = xbmcgui.DialogProgressBG()
@ -224,6 +226,8 @@ class LibrarySync():
if cleanNeeded:
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")
# display notification if set up
@ -263,8 +267,9 @@ class LibrarySync():
try:
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()
elif(dbSyncIndication == "BG Progress"):
pDialog = xbmcgui.DialogProgressBG()
@ -581,6 +586,8 @@ class LibrarySync():
if cleanNeeded:
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")
# display notification if set up
@ -619,8 +626,9 @@ class LibrarySync():
try:
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()
elif(dbSyncIndication == "BG Progress"):
pDialog = xbmcgui.DialogProgressBG()
@ -736,6 +744,8 @@ class LibrarySync():
if cleanNeeded:
self.doKodiLibraryUpdate(True, pDialog)
if(dbSyncFirstRun != "true"):
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
addon.setSetting("SyncFirstMusicVideoRunDone", "true")
finally:
@ -768,8 +778,9 @@ class LibrarySync():
try:
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()
elif(playCountSyncIndication == "BG Progress"):
pDialog = xbmcgui.DialogProgressBG()
@ -900,6 +911,8 @@ class LibrarySync():
showCurrent += 1
if(playCountSyncFirstRun != "true"):
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
addon.setSetting("SyncFirstCountsRunDone", "true")
# display notification if set up

View file

@ -6,8 +6,7 @@ import threading
import json
from datetime import datetime
addonSettings = xbmcaddon.Addon(id='plugin.video.mb3sync')
cwd = addonSettings.getAddonInfo('path')
cwd = xbmcaddon.Addon(id='plugin.video.mb3sync').getAddonInfo('path')
BASE_RESOURCE_PATH = xbmc.translatePath( os.path.join( cwd, 'resources', 'lib' ) )
sys.path.append(BASE_RESOURCE_PATH)