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)):
return False
# display notification if set up # display notification if set up
notificationString = "" notificationString = ""
if(totalItemsAdded > 0): if(totalItemsAdded > 0):
notificationString += "Added:" + str(totalItemsAdded) + " " notificationString += "Added:" + str(totalItemsAdded) + " "
if(totalItemsUpdated > 0): if(totalItemsUpdated > 0):
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 != ""): timeTaken = datetime.today() - startedSync
notificationString = "(" + timeTakenString + ") " + notificationString timeTakenString = str(int(timeTaken.seconds / 60)) + ":" + str(timeTaken.seconds % 60)
xbmc.executebuiltin("XBMC.Notification(Episode Sync: " + notificationString + ",)") utils.logMsg("Sync Episodes", "Finished " + timeTakenString + " " + notificationString, 0)
elif(dbSyncIndication == "Notify OnFinish"):
if(notificationString == ""): if(dbSyncIndication == "Notify OnChange" and notificationString != ""):
notificationString = "Done" notificationString = "(" + timeTakenString + ") " + notificationString
notificationString = "(" + timeTakenString + ") " + notificationString xbmc.executebuiltin("XBMC.Notification(Episode Sync: " + notificationString + ",)")
xbmc.executebuiltin("XBMC.Notification(Episode Sync: " + notificationString + ",)") elif(dbSyncIndication == "Notify OnFinish"):
if(notificationString == ""):
notificationString = "Done"
notificationString = "(" + timeTakenString + ") " + notificationString
xbmc.executebuiltin("XBMC.Notification(Episode Sync: " + notificationString + ",)")
finally: finally:
if(pDialog != None): if(pDialog != None):