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') addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
WINDOW = xbmcgui.Window( 10000 ) WINDOW = xbmcgui.Window( 10000 )
pDialog = None pDialog = None
startedSync = datetime.today()
try: try:
dbSyncIndication = addon.getSetting("dbSyncIndication") dbSyncIndication = addon.getSetting("dbSyncIndication")
if(addon.getSetting("SyncFirstMovieRunDone") != 'true'): if(addon.getSetting("SyncFirstMovieRunDone") != "true" or dbSyncIndication == "Dialog Progress"):
pDialog = xbmcgui.DialogProgress() pDialog = xbmcgui.DialogProgress()
elif(dbSyncIndication == "Progress"): elif(dbSyncIndication == "BG Progress"):
pDialog = xbmcgui.DialogProgressBG() pDialog = xbmcgui.DialogProgressBG()
if(pDialog != None): if(pDialog != None):
@ -217,7 +218,7 @@ class LibrarySync():
addon.setSetting("SyncFirstMovieRunDone", "true") addon.setSetting("SyncFirstMovieRunDone", "true")
if(dbSyncIndication == "Notification"): # display notification if set up
notificationString = "" notificationString = ""
if(totalItemsAdded > 0): if(totalItemsAdded > 0):
notificationString += "Added:" + str(totalItemsAdded) + " " notificationString += "Added:" + str(totalItemsAdded) + " "
@ -225,8 +226,18 @@ class LibrarySync():
notificationString += "Updated:" + str(totalItemsUpdated) + " " notificationString += "Updated:" + str(totalItemsUpdated) + " "
if(totalItemsDeleted > 0): if(totalItemsDeleted > 0):
notificationString += "Deleted:" + str(totalItemsDeleted) + " " 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 == ""): if(notificationString == ""):
notificationString = "Done" notificationString = "Done"
notificationString = "(" + timeTakenString + ") " + notificationString
xbmc.executebuiltin("XBMC.Notification(Movie Sync: " + notificationString + ",)") xbmc.executebuiltin("XBMC.Notification(Movie Sync: " + notificationString + ",)")
finally: finally:
@ -240,13 +251,14 @@ class LibrarySync():
addon = xbmcaddon.Addon(id='plugin.video.mb3sync') addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
WINDOW = xbmcgui.Window( 10000 ) WINDOW = xbmcgui.Window( 10000 )
pDialog = None pDialog = None
startedSync = datetime.today()
try: try:
dbSyncIndication = addon.getSetting("dbSyncIndication") dbSyncIndication = addon.getSetting("dbSyncIndication")
if(addon.getSetting("SyncFirstTVRunDone") != 'true'): if(addon.getSetting("SyncFirstTVRunDone") != "true" or dbSyncIndication == "Dialog Progress"):
pDialog = xbmcgui.DialogProgress() pDialog = xbmcgui.DialogProgress()
elif(dbSyncIndication == "Progress"): elif(dbSyncIndication == "BG Progress"):
pDialog = xbmcgui.DialogProgressBG() pDialog = xbmcgui.DialogProgressBG()
if(pDialog != None): if(pDialog != None):
@ -563,7 +575,7 @@ class LibrarySync():
addon.setSetting("SyncFirstTVRunDone", "true") addon.setSetting("SyncFirstTVRunDone", "true")
if(dbSyncIndication == "Notification"): # display notification if set up
notificationString = "" notificationString = ""
if(totalItemsAdded > 0): if(totalItemsAdded > 0):
notificationString += "Added:" + str(totalItemsAdded) + " " notificationString += "Added:" + str(totalItemsAdded) + " "
@ -571,9 +583,19 @@ class LibrarySync():
notificationString += "Updated:" + str(totalItemsUpdated) + " " notificationString += "Updated:" + str(totalItemsUpdated) + " "
if(totalItemsDeleted > 0): if(totalItemsDeleted > 0):
notificationString += "Deleted:" + str(totalItemsDeleted) + " " 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 == ""): if(notificationString == ""):
notificationString = "Done" notificationString = "Done"
xbmc.executebuiltin("XBMC.Notification(TV Sync: " + notificationString + ",)") notificationString = "(" + timeTakenString + ") " + notificationString
xbmc.executebuiltin("XBMC.Notification(Episode Sync: " + notificationString + ",)")
finally: finally:
if(pDialog != None): if(pDialog != None):
@ -590,9 +612,9 @@ class LibrarySync():
try: try:
dbSyncIndication = addon.getSetting("dbSyncIndication") dbSyncIndication = addon.getSetting("dbSyncIndication")
if(addon.getSetting("SyncFirstMusicVideoRunDone") != 'true'): if(addon.getSetting("SyncFirstMusicVideoRunDone") != "true" or dbSyncIndication == "Dialog Progress"):
pDialog = xbmcgui.DialogProgress() pDialog = xbmcgui.DialogProgress()
elif(dbSyncIndication == "Progress"): elif(dbSyncIndication == "BG Progress"):
pDialog = xbmcgui.DialogProgressBG() pDialog = xbmcgui.DialogProgressBG()
if(pDialog != None): if(pDialog != None):
@ -732,16 +754,16 @@ class LibrarySync():
addon = xbmcaddon.Addon(id='plugin.video.mb3sync') addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
WINDOW = xbmcgui.Window( 10000 ) WINDOW = xbmcgui.Window( 10000 )
pDialog = None pDialog = None
startedSync = datetime.today()
processMovies = True processMovies = True
processTvShows = True processTvShows = True
try: try:
playCountSyncIndication = addon.getSetting("playCountSyncIndication") playCountSyncIndication = addon.getSetting("playCountSyncIndication")
if(addon.getSetting("SyncFirstCountsRunDone") != 'true'): if(addon.getSetting("SyncFirstCountsRunDone") != "true" or playCountSyncIndication == "Dialog Progress"):
pDialog = xbmcgui.DialogProgress() pDialog = xbmcgui.DialogProgress()
elif(playCountSyncIndication == "Progress"): elif(playCountSyncIndication == "BG Progress"):
pDialog = xbmcgui.DialogProgressBG() pDialog = xbmcgui.DialogProgressBG()
if(pDialog != None): if(pDialog != None):
@ -870,15 +892,25 @@ class LibrarySync():
addon.setSetting("SyncFirstCountsRunDone", "true") addon.setSetting("SyncFirstCountsRunDone", "true")
if(playCountSyncIndication == "Notification"): # display notification if set up
notificationString = "" notificationString = ""
if(totalPositionsUpdated > 0): if(totalPositionsUpdated > 0):
notificationString += "Pos:" + str(totalPositionsUpdated) + " " notificationString += "Pos:" + str(totalPositionsUpdated) + " "
if(totalCountsUpdated > 0): if(totalCountsUpdated > 0):
notificationString += "Counts:" + str(totalCountsUpdated) + " " 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 == ""): if(notificationString == ""):
notificationString = "Done" notificationString = "Done"
xbmc.executebuiltin("XBMC.Notification(Play Sync: " + notificationString + ",)") notificationString = "(" + timeTakenString + ") " + notificationString
xbmc.executebuiltin("XBMC.Notification(PlayCount Sync: " + notificationString + ",)")
finally: finally:
if(pDialog != None): 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="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="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="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="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|Notification|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>
<category label="30014"> <!-- MediaBrowser --> <category label="30014"> <!-- MediaBrowser -->