diff --git a/resources/lib/CreateFiles.py b/resources/lib/CreateFiles.py index 30a83bb7..2faef192 100644 --- a/resources/lib/CreateFiles.py +++ b/resources/lib/CreateFiles.py @@ -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") diff --git a/resources/lib/WriteKodiDB.py b/resources/lib/WriteKodiDB.py index 7c14ba7b..4c4bd22d 100644 --- a/resources/lib/WriteKodiDB.py +++ b/resources/lib/WriteKodiDB.py @@ -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)