Back out delete

Need to add check if item is already deleted on Emby server
This commit is contained in:
xnappo 2015-03-23 22:54:11 -05:00
parent c90ae07a53
commit c9fb82cf3c

View file

@ -10,6 +10,7 @@ import json
import Utils as utils import Utils as utils
from WriteKodiDB import WriteKodiDB from WriteKodiDB import WriteKodiDB
from DownloadUtils import DownloadUtils
class Kodi_Monitor(xbmc.Monitor): class Kodi_Monitor(xbmc.Monitor):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
@ -20,7 +21,10 @@ class Kodi_Monitor(xbmc.Monitor):
#this library monitor is used to detect a watchedstate change by the user through the library #this library monitor is used to detect a watchedstate change by the user through the library
def onNotification (self,sender,method,data): def onNotification (self,sender,method,data):
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
port = addon.getSetting('port')
host = addon.getSetting('ipaddress')
server = host + ":" + port
if method == "VideoLibrary.OnUpdate": if method == "VideoLibrary.OnUpdate":
jsondata = json.loads(data) jsondata = json.loads(data)
@ -34,14 +38,19 @@ class Kodi_Monitor(xbmc.Monitor):
utils.logMsg("MB# Sync","Kodi_Monitor--> VideoLibrary.OnUpdate : " + str(data),2) utils.logMsg("MB# Sync","Kodi_Monitor--> VideoLibrary.OnUpdate : " + str(data),2)
WriteKodiDB().updatePlayCountFromKodi(item, type, playcount) WriteKodiDB().updatePlayCountFromKodi(item, type, playcount)
if method == "VideoLibrary.OnRemove": if method == "VideoLibrary.OnRemove":
xbmc.log('Intercepted remove from sender: ' + sender + ' method: ' + method + ' data: ' + data)
jsondata = json.loads(data) jsondata = json.loads(data)
if jsondata != None: if jsondata != None:
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 )
MBlist = WINDOW.getProperty("episodeid" + str(episodeid)).split(";;") MBlist = WINDOW.getProperty("episodeid" + str(episodeid)).split(";;")
return_value = xbmcgui.Dialog().yesno("Confirm Delete", "Not really going to, but if I were I would delete: Title - "+ MBlist[0] + " MBID: " + MBlist[1]) #NEED TO CHECK IF ITEM STILL EXISTS ON EMBY SERVER
#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")