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
|
||||
|
||||
# DELETES -- EPISODES
|
||||
# process any deletes only at fullsync
|
||||
allMB3EpisodeIds = set(allMB3EpisodeIds)
|
||||
for episode in allKodiEpisodeIds:
|
||||
if episode.get('mbid') not in allMB3EpisodeIds:
|
||||
WriteKodiDB().deleteEpisodeFromKodiLibrary(episode.get('kodiid'))
|
||||
|
||||
# TODO --> process deletes for episodes !!!
|
||||
# DELETES -- TV SHOWS
|
||||
if fullsync:
|
||||
allLocaldirs, filesTVShows = xbmcvfs.listdir(tvLibrary)
|
||||
allMB3TVShows = set(allTVShows)
|
||||
|
|
|
@ -635,16 +635,25 @@ class WriteKodiDB():
|
|||
xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.RemoveMovie", "params": { "movieid": %i}, "id": 1 }' %(kodiItem["movieid"]))
|
||||
|
||||
path = os.path.join(movieLibrary,id)
|
||||
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 ):
|
||||
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 != []:
|
||||
jsonobject = json.loads(json_response.decode('utf-8','replace'))
|
||||
|
||||
print jsonobject
|
||||
print "episodedetails --> " + jsonobject
|
||||
if(jsonobject.has_key('result')):
|
||||
result = jsonobject['result']
|
||||
if(result.has_key('episodedetails')):
|
||||
|
@ -652,6 +661,8 @@ class WriteKodiDB():
|
|||
|
||||
strmfile = episodedetails["file"]
|
||||
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)))
|
||||
|
||||
|
@ -677,11 +688,17 @@ class WriteKodiDB():
|
|||
xbmc.sleep(sleepVal)
|
||||
kodiItem = ReadKodiDB().getKodiTVShow(id)
|
||||
utils.logMsg("deleting tvshow from Kodi library",id)
|
||||
|
||||
if kodiItem != None:
|
||||
xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.RemoveTVShow", "params": { "tvshowid": %i}, "id": 1 }' %(kodiItem["tvshowid"]))
|
||||
path = os.path.join(tvLibrary,id)
|
||||
xbmcvfs.rmdir(path)
|
||||
|
||||
path = os.path.join(tvLibrary,id)
|
||||
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):
|
||||
#use sqlite to set the season artwork because no method in API available for this
|
||||
|
|
Loading…
Reference in a new issue