fix episode deletions cleanup

This commit is contained in:
Marcel van der Veldt 2015-03-29 23:37:02 +02:00
parent 9a17eab206
commit abf2fd2c5a
2 changed files with 8 additions and 5 deletions

View file

@ -54,7 +54,7 @@ class CreateFiles():
strmFile = os.path.join(itemPath,filenamestr)
changes = False
if not xbmcvfs.exists(strmFile):
if not xbmcvfs.exists(strmFile) and not xbmcvfs.exists(strmFile.replace(".strm",".emby")):
changes = True
xbmcvfs.mkdir(itemPath)
text_file = open(strmFile, "w")

View file

@ -761,13 +761,16 @@ class WriteKodiDB():
utils.logMsg("deleting episode from Kodi library",episodeid)
episode = ReadKodiDB().getKodiEpisodeByMbItem(episodeid, tvshowid)
if episode != None:
strmfile = episode["file"]
nfofile = strmfile.replace(".strm",".nfo")
WINDOW = xbmcgui.Window( 10000 )
WINDOW.setProperty("suspendDeletes", "True")
xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.RemoveEpisode", "params": { "episodeid": %i}, "id": 1 }' %(episode["episodeid"]))
xbmcvfs.delete(strmfile)
xbmcvfs.delete(nfofile)
itemPath = os.path.join(tvLibrary,tvshowid)
allDirs, allFiles = xbmcvfs.listdir(itemPath)
for file in allFiles:
if episodeid in file:
xbmcvfs.delete(file)
while WINDOW.getProperty("suspendDeletes") == "True":
xbmc.sleep(100)
utils.logMsg("episode deleted succesfully!",episodeid)