From 0b9b5d3e643cbde64bd7df5c6e1d013a60be2360 Mon Sep 17 00:00:00 2001 From: xnappo Date: Sat, 4 Jul 2015 10:04:04 -0500 Subject: [PATCH] Expand offer delete to movies (optionally) --- resources/language/English/strings.xml | 10 ++++++---- resources/lib/KodiMonitor.py | 2 +- resources/lib/PlaybackUtils.py | 4 +++- resources/lib/Player.py | 11 +++++++---- resources/settings.xml | 6 ++++-- 5 files changed, 21 insertions(+), 12 deletions(-) diff --git a/resources/language/English/strings.xml b/resources/language/English/strings.xml index 33d65f09..a5c50521 100644 --- a/resources/language/English/strings.xml +++ b/resources/language/English/strings.xml @@ -97,9 +97,9 @@ Include Stream Info Include People Include Overview - On Resume Jump Back Seconds - - Offer delete when stopped above % - Add Item and Played Counts + Offer delete after playback + - For Episodes + - For Movies Background Art Refresh Rate (seconds) Add Resume Percent Add Episode Number @@ -110,7 +110,7 @@ Downloading Jason Data Done Processing Item : - Offer delete for watched episodes + YOUCANUSETHIS Play Error This item is not playable Local path detected @@ -255,6 +255,8 @@ Music Videos Music Tracks Channels + + diff --git a/resources/lib/KodiMonitor.py b/resources/lib/KodiMonitor.py index e6be1443..e2d8cdd5 100644 --- a/resources/lib/KodiMonitor.py +++ b/resources/lib/KodiMonitor.py @@ -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) diff --git a/resources/lib/PlaybackUtils.py b/resources/lib/PlaybackUtils.py index 8211e115..026ebeaa 100644 --- a/resources/lib/PlaybackUtils.py +++ b/resources/lib/PlaybackUtils.py @@ -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")) diff --git a/resources/lib/Player.py b/resources/lib/Player.py index 00390ea3..3e5fd9cd 100644 --- a/resources/lib/Player.py +++ b/resources/lib/Player.py @@ -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": diff --git a/resources/settings.xml b/resources/settings.xml index 6eaca198..83ea2959 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -25,7 +25,9 @@ - + + + @@ -35,7 +37,7 @@ - +