Error handling for delete, but still not working :(
This commit is contained in:
parent
4c5debaa1e
commit
bb3f52ea51
2 changed files with 17 additions and 14 deletions
|
@ -495,9 +495,11 @@ class LibrarySync():
|
|||
|
||||
#add all kodi episodes to a list with episodes for use later on to delete episodes
|
||||
#the mediabrowser ID is set as uniqueID in the NFO... for some reason this has key 'unknown' in the json response
|
||||
for episode in ReadKodiDB().getKodiEpisodes(tvshow,False,False):
|
||||
dict = {'mbid': str(episode["uniqueid"]["unknown"]),'kodiid': str(episode["episodeid"])}
|
||||
allKodiEpisodeIds.append(dict)
|
||||
show = ReadKodiDB().getKodiEpisodes(tvshow,False,False)
|
||||
if show != None:
|
||||
for episode in show:
|
||||
dict = {'mbid': str(episode["uniqueid"]["unknown"]),'kodiid': str(episode["episodeid"])}
|
||||
allKodiEpisodeIds.append(dict)
|
||||
|
||||
showCurrent += 1
|
||||
|
||||
|
|
|
@ -424,21 +424,22 @@ class WriteKodiDB():
|
|||
utils.logMsg("deleting episode from Kodi library",episodeid)
|
||||
|
||||
json_response = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetEpisodeDetails", "params": { "episodeid": %i}, "properties" : ["file","episodeid"] }, "id": 1}' %(int(episodeid)))
|
||||
jsonobject = json.loads(json_response.decode('utf-8','replace'))
|
||||
if json_response != None and json_response != "" and json_response != []:
|
||||
jsonobject = json.loads(json_response.decode('utf-8','replace'))
|
||||
|
||||
print jsonobject
|
||||
if(jsonobject.has_key('result')):
|
||||
result = jsonobject['result']
|
||||
if(result.has_key('episodedetails')):
|
||||
episodedetails = result['episodedetails']
|
||||
print jsonobject
|
||||
if(jsonobject.has_key('result')):
|
||||
result = jsonobject['result']
|
||||
if(result.has_key('episodedetails')):
|
||||
episodedetails = result['episodedetails']
|
||||
|
||||
strmfile = episodedetails["file"]
|
||||
nfofile = strmfile.replace(".strm",".nfo")
|
||||
strmfile = episodedetails["file"]
|
||||
nfofile = strmfile.replace(".strm",".nfo")
|
||||
|
||||
xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.RemoveEpisode", "params": { "episodeid": %i}, "id": 1 }' %(int(episodeid)))
|
||||
xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.RemoveEpisode", "params": { "episodeid": %i}, "id": 1 }' %(int(episodeid)))
|
||||
|
||||
xbmcvfs.delete(strmfile)
|
||||
xbmcvfs.delete(nfofile)
|
||||
xbmcvfs.delete(strmfile)
|
||||
xbmcvfs.delete(nfofile)
|
||||
|
||||
def addTVShowToKodiLibrary( self, item ):
|
||||
itemPath = os.path.join(tvLibrary,item["Id"])
|
||||
|
|
Loading…
Reference in a new issue