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,15 +45,17 @@ class Kodi_Monitor(xbmc.Monitor):
if jsondata.get("type") == "episode":
episodeid = jsondata.get("id")
WINDOW = xbmcgui.Window( 10000 )
MBlist = WINDOW.getProperty("episodeid" + str(episodeid)).split(";;")
url='http://' + server + '/mediabrowser/Items?Ids=' + MBlist[1] + '&format=json'
data = DownloadUtils().downloadUrl(url=url, suppress=True, popup=0)
if data != "":
return_value = xbmcgui.Dialog().yesno("Confirm Delete", "Delete: "+ MBlist[0] + "\n on Emby Server?\nEmbyID: " + MBlist[1])
if return_value:
url='http://' + server + '/mediabrowser/Items/' + MBlist[1]
xbmc.log('Deleting via URL: ' + url)
DownloadUtils().downloadUrl(url, type="DELETE")
#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(";;")
url='http://' + server + '/mediabrowser/Items?Ids=' + MBlist[1] + '&format=json'
data = DownloadUtils().downloadUrl(url=url, suppress=True, popup=0)
if data != "":
return_value = xbmcgui.Dialog().yesno("Confirm Delete", "Delete: "+ MBlist[0] + "\n on Emby Server?\nEmbyID: " + MBlist[1])
if return_value:
url='http://' + server + '/mediabrowser/Items/' + MBlist[1]
xbmc.log('Deleting via URL: ' + url)
DownloadUtils().downloadUrl(url, type="DELETE")

View file

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