fixed false positive deletion warning on library updates in kodimonitor thread

This commit is contained in:
Marcel van der Veldt 2015-03-25 21:00:38 +01:00
parent 824cd6bef0
commit 6b004564bf
2 changed files with 13 additions and 9 deletions

View file

@ -45,6 +45,8 @@ class Kodi_Monitor(xbmc.Monitor):
if jsondata.get("type") == "episode": if jsondata.get("type") == "episode":
episodeid = jsondata.get("id") episodeid = jsondata.get("id")
WINDOW = xbmcgui.Window( 10000 ) WINDOW = xbmcgui.Window( 10000 )
#ignore if the item has just been deleted by the background sync
if not WINDOW.getProperty(episodeid,"deleted"):
MBlist = WINDOW.getProperty("episodeid" + str(episodeid)).split(";;") MBlist = WINDOW.getProperty("episodeid" + str(episodeid)).split(";;")
url='http://' + server + '/mediabrowser/Items?Ids=' + MBlist[1] + '&format=json' url='http://' + server + '/mediabrowser/Items?Ids=' + MBlist[1] + '&format=json'
data = DownloadUtils().downloadUrl(url=url, suppress=True, popup=0) data = DownloadUtils().downloadUrl(url=url, suppress=True, popup=0)

View file

@ -215,6 +215,7 @@ class LibrarySync():
allEmbyMovieIds = set(allEmbyMovieIds) allEmbyMovieIds = set(allEmbyMovieIds)
for kodiId in allKodiIds: for kodiId in allKodiIds:
if not kodiId in allEmbyMovieIds: if not kodiId in allEmbyMovieIds:
WINDOW.setProperty(kodiId,"deleted")
WriteKodiDB().deleteMovieFromKodiLibrary(kodiId) WriteKodiDB().deleteMovieFromKodiLibrary(kodiId)
cleanNeeded = True cleanNeeded = True
totalItemsDeleted += 1 totalItemsDeleted += 1
@ -567,6 +568,7 @@ class LibrarySync():
allMB3EpisodeIds = set(allMB3EpisodeIds) allMB3EpisodeIds = set(allMB3EpisodeIds)
for episode in allKodiEpisodeIds: for episode in allKodiEpisodeIds:
if episode.get('episodeid') not in allMB3EpisodeIds: if episode.get('episodeid') not in allMB3EpisodeIds:
WINDOW.setProperty(episode.get('episodeid'),"deleted")
WriteKodiDB().deleteEpisodeFromKodiLibrary(episode.get('episodeid'),episode.get('tvshowid')) WriteKodiDB().deleteEpisodeFromKodiLibrary(episode.get('episodeid'),episode.get('tvshowid'))
cleanneeded = True cleanneeded = True
totalItemsDeleted += 1 totalItemsDeleted += 1