add some more notification options

This commit is contained in:
faush01 2015-03-24 10:02:46 +11:00
parent cf03ca9f4f
commit 0c92e86b39
2 changed files with 70 additions and 38 deletions

View file

@ -77,13 +77,14 @@ class LibrarySync():
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
WINDOW = xbmcgui.Window( 10000 )
pDialog = None
startedSync = datetime.today()
try:
dbSyncIndication = addon.getSetting("dbSyncIndication")
if(addon.getSetting("SyncFirstMovieRunDone") != 'true'):
if(addon.getSetting("SyncFirstMovieRunDone") != "true" or dbSyncIndication == "Dialog Progress"):
pDialog = xbmcgui.DialogProgress()
elif(dbSyncIndication == "Progress"):
elif(dbSyncIndication == "BG Progress"):
pDialog = xbmcgui.DialogProgressBG()
if(pDialog != None):
@ -217,16 +218,26 @@ class LibrarySync():
addon.setSetting("SyncFirstMovieRunDone", "true")
if(dbSyncIndication == "Notification"):
notificationString = ""
if(totalItemsAdded > 0):
notificationString += "Added:" + str(totalItemsAdded) + " "
if(totalItemsUpdated > 0):
notificationString += "Updated:" + str(totalItemsUpdated) + " "
if(totalItemsDeleted > 0):
notificationString += "Deleted:" + str(totalItemsDeleted) + " "
# display notification if set up
notificationString = ""
if(totalItemsAdded > 0):
notificationString += "Added:" + str(totalItemsAdded) + " "
if(totalItemsUpdated > 0):
notificationString += "Updated:" + str(totalItemsUpdated) + " "
if(totalItemsDeleted > 0):
notificationString += "Deleted:" + str(totalItemsDeleted) + " "
timeTaken = datetime.today() - startedSync
timeTakenString = str(int(timeTaken.seconds / 60)) + ":" + str(timeTaken.seconds % 60)
utils.logMsg("Sync Movies", "Finished " + timeTakenString + " " + notificationString, 0)
if(dbSyncIndication == "Notify OnChange" and notificationString != ""):
notificationString = "(" + timeTakenString + ") " + notificationString
xbmc.executebuiltin("XBMC.Notification(Movie Sync: " + notificationString + ",)")
elif(dbSyncIndication == "Notify OnFinish"):
if(notificationString == ""):
notificationString = "Done"
notificationString = "(" + timeTakenString + ") " + notificationString
xbmc.executebuiltin("XBMC.Notification(Movie Sync: " + notificationString + ",)")
finally:
@ -240,13 +251,14 @@ class LibrarySync():
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
WINDOW = xbmcgui.Window( 10000 )
pDialog = None
startedSync = datetime.today()
try:
dbSyncIndication = addon.getSetting("dbSyncIndication")
if(addon.getSetting("SyncFirstTVRunDone") != 'true'):
if(addon.getSetting("SyncFirstTVRunDone") != "true" or dbSyncIndication == "Dialog Progress"):
pDialog = xbmcgui.DialogProgress()
elif(dbSyncIndication == "Progress"):
elif(dbSyncIndication == "BG Progress"):
pDialog = xbmcgui.DialogProgressBG()
if(pDialog != None):
@ -563,17 +575,27 @@ class LibrarySync():
addon.setSetting("SyncFirstTVRunDone", "true")
if(dbSyncIndication == "Notification"):
notificationString = ""
if(totalItemsAdded > 0):
notificationString += "Added:" + str(totalItemsAdded) + " "
if(totalItemsUpdated > 0):
notificationString += "Updated:" + str(totalItemsUpdated) + " "
if(totalItemsDeleted > 0):
notificationString += "Deleted:" + str(totalItemsDeleted) + " "
# display notification if set up
notificationString = ""
if(totalItemsAdded > 0):
notificationString += "Added:" + str(totalItemsAdded) + " "
if(totalItemsUpdated > 0):
notificationString += "Updated:" + str(totalItemsUpdated) + " "
if(totalItemsDeleted > 0):
notificationString += "Deleted:" + str(totalItemsDeleted) + " "
timeTaken = datetime.today() - startedSync
timeTakenString = str(int(timeTaken.seconds / 60)) + ":" + str(timeTaken.seconds % 60)
utils.logMsg("Sync Episodes", "Finished " + timeTakenString + " " + notificationString, 0)
if(dbSyncIndication == "Notify OnChange" and notificationString != ""):
notificationString = "(" + timeTakenString + ") " + notificationString
xbmc.executebuiltin("XBMC.Notification(Episode Sync: " + notificationString + ",)")
elif(dbSyncIndication == "Notify OnFinish"):
if(notificationString == ""):
notificationString = "Done"
xbmc.executebuiltin("XBMC.Notification(TV Sync: " + notificationString + ",)")
notificationString = "(" + timeTakenString + ") " + notificationString
xbmc.executebuiltin("XBMC.Notification(Episode Sync: " + notificationString + ",)")
finally:
if(pDialog != None):
@ -590,9 +612,9 @@ class LibrarySync():
try:
dbSyncIndication = addon.getSetting("dbSyncIndication")
if(addon.getSetting("SyncFirstMusicVideoRunDone") != 'true'):
if(addon.getSetting("SyncFirstMusicVideoRunDone") != "true" or dbSyncIndication == "Dialog Progress"):
pDialog = xbmcgui.DialogProgress()
elif(dbSyncIndication == "Progress"):
elif(dbSyncIndication == "BG Progress"):
pDialog = xbmcgui.DialogProgressBG()
if(pDialog != None):
@ -732,16 +754,16 @@ class LibrarySync():
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
WINDOW = xbmcgui.Window( 10000 )
pDialog = None
startedSync = datetime.today()
processMovies = True
processTvShows = True
try:
playCountSyncIndication = addon.getSetting("playCountSyncIndication")
if(addon.getSetting("SyncFirstCountsRunDone") != 'true'):
if(addon.getSetting("SyncFirstCountsRunDone") != "true" or playCountSyncIndication == "Dialog Progress"):
pDialog = xbmcgui.DialogProgress()
elif(playCountSyncIndication == "Progress"):
elif(playCountSyncIndication == "BG Progress"):
pDialog = xbmcgui.DialogProgressBG()
if(pDialog != None):
@ -870,15 +892,25 @@ class LibrarySync():
addon.setSetting("SyncFirstCountsRunDone", "true")
if(playCountSyncIndication == "Notification"):
notificationString = ""
if(totalPositionsUpdated > 0):
notificationString += "Pos:" + str(totalPositionsUpdated) + " "
if(totalCountsUpdated > 0):
notificationString += "Counts:" + str(totalCountsUpdated) + " "
# display notification if set up
notificationString = ""
if(totalPositionsUpdated > 0):
notificationString += "Pos:" + str(totalPositionsUpdated) + " "
if(totalCountsUpdated > 0):
notificationString += "Counts:" + str(totalCountsUpdated) + " "
timeTaken = datetime.today() - startedSync
timeTakenString = str(int(timeTaken.seconds / 60)) + ":" + str(timeTaken.seconds % 60)
utils.logMsg("Sync PlayCount", "Finished " + timeTakenString + " " + notificationString, 0)
if(playCountSyncIndication == "Notify OnChange" and notificationString != ""):
notificationString = "(" + timeTakenString + ") " + notificationString
xbmc.executebuiltin("XBMC.Notification(PlayCount Sync: " + notificationString + ",)")
elif(playCountSyncIndication == "Notify OnFinish"):
if(notificationString == ""):
notificationString = "Done"
xbmc.executebuiltin("XBMC.Notification(Play Sync: " + notificationString + ",)")
notificationString = "(" + timeTakenString + ") " + notificationString
xbmc.executebuiltin("XBMC.Notification(PlayCount Sync: " + notificationString + ",)")
finally:
if(pDialog != None):

View file

@ -11,8 +11,8 @@
<setting id="enablePlayCountSync" type="bool" label="Enable watched/resume status sync" default="true" visible="true" enable="true" />
<setting id="syncSettingStartup" type="labelenum" label="Startup Sync:" values="Full Sync|Incremental Sync|None" default="Full Sync" />
<setting id="syncSettingBackground" type="labelenum" label="Scheduled Sync:" values="Full Sync|Incremental Sync|None" default="Full Sync" visible="true" enable="true" />
<setting id="dbSyncIndication" type="labelenum" label="DB Sync Indication:" values="None|Notification|Progress" default="None" />
<setting id="playCountSyncIndication" type="labelenum" label="Play Count Sync Indication:" values="None|Notification|Progress" default="None" />
<setting id="dbSyncIndication" type="labelenum" label="DB Sync Indication:" values="None|Notify OnChange|Notify OnFinish|BG Progress|Dialog Progress" default="None" />
<setting id="playCountSyncIndication" type="labelenum" label="Play Count Sync Indication:" values="None|Notify OnChange|Notify OnFinish|BG Progress|Dialog Progress" default="None" />
</category>
<category label="30014"> <!-- MediaBrowser -->