mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-25 10:16:11 +00:00
fixed tv show deletions
This commit is contained in:
parent
78bc187c1f
commit
9287706ced
2 changed files with 26 additions and 8 deletions
|
@ -503,13 +503,14 @@ class LibrarySync():
|
||||||
|
|
||||||
cleanNeeded = False
|
cleanNeeded = False
|
||||||
|
|
||||||
|
# DELETES -- EPISODES
|
||||||
# process any deletes only at fullsync
|
# process any deletes only at fullsync
|
||||||
allMB3EpisodeIds = set(allMB3EpisodeIds)
|
allMB3EpisodeIds = set(allMB3EpisodeIds)
|
||||||
for episode in allKodiEpisodeIds:
|
for episode in allKodiEpisodeIds:
|
||||||
if episode.get('mbid') not in allMB3EpisodeIds:
|
if episode.get('mbid') not in allMB3EpisodeIds:
|
||||||
WriteKodiDB().deleteEpisodeFromKodiLibrary(episode.get('kodiid'))
|
WriteKodiDB().deleteEpisodeFromKodiLibrary(episode.get('kodiid'))
|
||||||
|
|
||||||
# TODO --> process deletes for episodes !!!
|
# DELETES -- TV SHOWS
|
||||||
if fullsync:
|
if fullsync:
|
||||||
allLocaldirs, filesTVShows = xbmcvfs.listdir(tvLibrary)
|
allLocaldirs, filesTVShows = xbmcvfs.listdir(tvLibrary)
|
||||||
allMB3TVShows = set(allTVShows)
|
allMB3TVShows = set(allTVShows)
|
||||||
|
|
|
@ -635,16 +635,25 @@ class WriteKodiDB():
|
||||||
xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.RemoveMovie", "params": { "movieid": %i}, "id": 1 }' %(kodiItem["movieid"]))
|
xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.RemoveMovie", "params": { "movieid": %i}, "id": 1 }' %(kodiItem["movieid"]))
|
||||||
|
|
||||||
path = os.path.join(movieLibrary,id)
|
path = os.path.join(movieLibrary,id)
|
||||||
xbmcvfs.rmdir(path)
|
allDirs, allFiles = xbmcvfs.listdir(path)
|
||||||
|
for dir in allDirs:
|
||||||
|
xbmcvfs.rmdir(dir)
|
||||||
|
for file in allFiles:
|
||||||
|
xbmcvfs.delete(file)
|
||||||
|
xbmcvfs.rmdir(path)
|
||||||
|
|
||||||
|
|
||||||
def deleteEpisodeFromKodiLibrary(self, episodeid ):
|
def deleteEpisodeFromKodiLibrary(self, episodeid ):
|
||||||
utils.logMsg("deleting episode from Kodi library",episodeid)
|
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)))
|
json_response = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetEpisodeDetails", "params": { "episodeid": %s}, "properties": ["file","originaltitle"] }, "id": 1}' %(str(episodeid)))
|
||||||
|
|
||||||
|
print "episodedetails --> " + json_response
|
||||||
|
|
||||||
if json_response != None and json_response != "" and json_response != []:
|
if json_response != None and json_response != "" and json_response != []:
|
||||||
jsonobject = json.loads(json_response.decode('utf-8','replace'))
|
jsonobject = json.loads(json_response.decode('utf-8','replace'))
|
||||||
|
|
||||||
print jsonobject
|
print "episodedetails --> " + jsonobject
|
||||||
if(jsonobject.has_key('result')):
|
if(jsonobject.has_key('result')):
|
||||||
result = jsonobject['result']
|
result = jsonobject['result']
|
||||||
if(result.has_key('episodedetails')):
|
if(result.has_key('episodedetails')):
|
||||||
|
@ -652,7 +661,9 @@ class WriteKodiDB():
|
||||||
|
|
||||||
strmfile = episodedetails["file"]
|
strmfile = episodedetails["file"]
|
||||||
nfofile = strmfile.replace(".strm",".nfo")
|
nfofile = strmfile.replace(".strm",".nfo")
|
||||||
|
print "strmfile -->" + strmfile
|
||||||
|
print "nfofile -->" + nfofile
|
||||||
|
|
||||||
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(strmfile)
|
||||||
|
@ -677,11 +688,17 @@ class WriteKodiDB():
|
||||||
xbmc.sleep(sleepVal)
|
xbmc.sleep(sleepVal)
|
||||||
kodiItem = ReadKodiDB().getKodiTVShow(id)
|
kodiItem = ReadKodiDB().getKodiTVShow(id)
|
||||||
utils.logMsg("deleting tvshow from Kodi library",id)
|
utils.logMsg("deleting tvshow from Kodi library",id)
|
||||||
|
|
||||||
if kodiItem != None:
|
if kodiItem != None:
|
||||||
xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.RemoveTVShow", "params": { "tvshowid": %i}, "id": 1 }' %(kodiItem["tvshowid"]))
|
xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.RemoveTVShow", "params": { "tvshowid": %i}, "id": 1 }' %(kodiItem["tvshowid"]))
|
||||||
|
|
||||||
path = os.path.join(tvLibrary,id)
|
path = os.path.join(tvLibrary,id)
|
||||||
xbmcvfs.rmdir(path)
|
allDirs, allFiles = xbmcvfs.listdir(path)
|
||||||
|
for dir in allDirs:
|
||||||
|
xbmcvfs.rmdir(os.path.join(path,dir))
|
||||||
|
for file in allFiles:
|
||||||
|
xbmcvfs.delete(os.path.join(path,file))
|
||||||
|
xbmcvfs.rmdir(path)
|
||||||
|
|
||||||
def updateSeasonArtwork(self,MBitem, KodiItem):
|
def updateSeasonArtwork(self,MBitem, KodiItem):
|
||||||
#use sqlite to set the season artwork because no method in API available for this
|
#use sqlite to set the season artwork because no method in API available for this
|
||||||
|
|
Loading…
Reference in a new issue