Fix TV tags (for realz hopefully)

This commit is contained in:
xnappo 2015-04-05 10:46:34 -05:00
parent f46b67209c
commit fff293df24

View file

@ -539,55 +539,55 @@ class LibrarySync():
showCurrent += 1 showCurrent += 1
if(pDialog != None): if(pDialog != None):
progressTitle = "Removing Deleted Items" progressTitle = "Removing Deleted Items"
pDialog.update(0, progressTitle) pDialog.update(0, progressTitle)
if(self.ShouldStop(pDialog)): if(self.ShouldStop(pDialog)):
return False return False
# DELETES -- EPISODES # DELETES -- EPISODES
# process any deletes only at fullsync # process any deletes only at fullsync
allMB3EpisodeIdsSet = set(allMB3EpisodeIds) allMB3EpisodeIdsSet = set(allMB3EpisodeIds)
for episode in allKodiEpisodeIds: for episode in allKodiEpisodeIds:
if episode.get('episodeid') not in allMB3EpisodeIdsSet: if episode.get('episodeid') not in allMB3EpisodeIdsSet:
WINDOW.setProperty("embyid" + str(episode.get('episodeid')),"deleted") WINDOW.setProperty("embyid" + str(episode.get('episodeid')),"deleted")
WriteKodiDB().deleteEpisodeFromKodiLibrary(episode.get('episodeid'),episode.get('tvshowid')) WriteKodiDB().deleteEpisodeFromKodiLibrary(episode.get('episodeid'),episode.get('tvshowid'))
totalItemsDeleted += 1
# DELETES -- TV SHOWS
if fullsync:
allKodiShows = ReadKodiDB().getKodiTvShowsIds(True)
allMB3TVShows = set(allTVShows)
for show in allKodiShows:
if not show in allMB3TVShows:
WriteKodiDB().deleteTVShowFromKodiLibrary(show)
totalItemsDeleted += 1 totalItemsDeleted += 1
# DELETES -- TV SHOWS if(self.ShouldStop(pDialog)):
if fullsync: return False
allKodiShows = ReadKodiDB().getKodiTvShowsIds(True)
allMB3TVShows = set(allTVShows)
for show in allKodiShows:
if not show in allMB3TVShows:
WriteKodiDB().deleteTVShowFromKodiLibrary(show)
totalItemsDeleted += 1
if(self.ShouldStop(pDialog)): # display notification if set up
return False 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 timeTaken = datetime.today() - startedSync
notificationString = "" timeTakenString = str(int(timeTaken.seconds / 60)) + ":" + str(timeTaken.seconds % 60)
if(totalItemsAdded > 0): utils.logMsg("Sync Episodes", "Finished " + timeTakenString + " " + notificationString, 0)
notificationString += "Added:" + str(totalItemsAdded) + " "
if(totalItemsUpdated > 0):
notificationString += "Updated:" + str(totalItemsUpdated) + " "
if(totalItemsDeleted > 0):
notificationString += "Deleted:" + str(totalItemsDeleted) + " "
timeTaken = datetime.today() - startedSync if(dbSyncIndication == "Notify OnChange" and notificationString != ""):
timeTakenString = str(int(timeTaken.seconds / 60)) + ":" + str(timeTaken.seconds % 60) notificationString = "(" + timeTakenString + ") " + notificationString
utils.logMsg("Sync Episodes", "Finished " + timeTakenString + " " + notificationString, 0) xbmc.executebuiltin("XBMC.Notification(Episode Sync: " + notificationString + ",)")
elif(dbSyncIndication == "Notify OnFinish"):
if(dbSyncIndication == "Notify OnChange" and notificationString != ""): if(notificationString == ""):
notificationString = "(" + timeTakenString + ") " + notificationString notificationString = "Done"
xbmc.executebuiltin("XBMC.Notification(Episode Sync: " + notificationString + ",)") notificationString = "(" + timeTakenString + ") " + notificationString
elif(dbSyncIndication == "Notify OnFinish"): xbmc.executebuiltin("XBMC.Notification(Episode Sync: " + notificationString + ",)")
if(notificationString == ""):
notificationString = "Done"
notificationString = "(" + timeTakenString + ") " + notificationString
xbmc.executebuiltin("XBMC.Notification(Episode Sync: " + notificationString + ",)")
finally: finally:
if(pDialog != None): if(pDialog != None):