Expand offer delete to movies (optionally)

This commit is contained in:
xnappo 2015-07-04 10:04:04 -05:00
parent 851856eb52
commit 0b9b5d3e64
5 changed files with 21 additions and 12 deletions

View file

@ -134,7 +134,7 @@ class Kodi_Monitor(xbmc.Monitor):
cursor.close
if jsondata:
if jsondata.get("type") == "episode":
if jsondata.get("type") == "episode" or "movie":
url='{server}/mediabrowser/Items?Ids=' + id + '&format=json'
#This is a check to see if the item exists on the server, if it doesn't it may have already been deleted by another client
result = DownloadUtils().downloadUrl(url)

View file

@ -379,8 +379,10 @@ class PlaybackUtils():
WINDOW.setProperty(playurl + "positionurl", positionurl)
WINDOW.setProperty(playurl + "deleteurl", "")
if item.get("Type") == "Episode" and addon.getSetting("offerDelete")=="true":
if item.get("Type") == "Episode" and addon.getSetting("offerDeleteTV")=="true":
WINDOW.setProperty(playurl + "deleteurl", deleteurl)
if item.get("Type") == "Movie" and addon.getSetting("offerDeleteMovies")=="true":
WINDOW.setProperty(playurl + "deleteurl", deleteurl)
WINDOW.setProperty(playurl + "runtimeticks", str(item.get("RunTimeTicks")))
WINDOW.setProperty(playurl+"type", item.get("Type"))

View file

@ -103,15 +103,18 @@ class Player( xbmc.Player ):
self.stopPlayback(data)
if percentComplete > .80 and data.get("Type") == "Episode" and addonSettings.getSetting("offerDelete")=="true":
offerDelete=False
if data.get("Type") == "Episode" and addonSettings.getSetting("offerDeleteTV")=="true":
offerDelete = True
elif data.get("Type") == "Movie" and addonSettings.getSetting("offerDeleteMovies")=="true":
offerDelete = True
if percentComplete > .80 and offerDelete == True:
return_value = xbmcgui.Dialog().yesno("Offer Delete", "Delete\n" + data.get("currentfile").split("/")[-1] + "\non Emby Server? ")
if return_value:
# Delete Kodi entry before Emby
listItem = [item_id]
LibrarySync().removefromDB(listItem, True)
#if(refresh_id != None):
#report updates playcount and resume status to Kodi and MB3
#librarySync.updatePlayCount(item_id)
# Stop transcoding
if self.WINDOW.getProperty("transcoding%s" % item_id) == "true":