From f4ea4927c37a8621ef59884cdab3f9daaf6f2e8a Mon Sep 17 00:00:00 2001 From: xnappo Date: Tue, 26 May 2015 18:12:13 -0500 Subject: [PATCH] Minor fixes for direct path Fix toplevel tvshows path so info screen shows Some KodiMonitor fix from Shaun --- resources/lib/KodiMonitor.py | 2 +- resources/lib/WriteKodiVideoDB.py | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/resources/lib/KodiMonitor.py b/resources/lib/KodiMonitor.py index 4191fb3a..938ae554 100644 --- a/resources/lib/KodiMonitor.py +++ b/resources/lib/KodiMonitor.py @@ -35,7 +35,7 @@ class Kodi_Monitor(xbmc.Monitor): WINDOW = self.WINDOW downloadUtils = DownloadUtils() #player started playing an item - - if "Playlist.OnAdd" in method and addon.getSetting('useDirectPaths')=='true': + if ("Playlist.OnAdd" in method or "Player.OnPlay" in method) and addon.getSetting('useDirectPaths')=='true': jsondata = json.loads(data) if jsondata != None: diff --git a/resources/lib/WriteKodiVideoDB.py b/resources/lib/WriteKodiVideoDB.py index c32df971..582fc4b8 100644 --- a/resources/lib/WriteKodiVideoDB.py +++ b/resources/lib/WriteKodiVideoDB.py @@ -455,8 +455,17 @@ class WriteKodiVideoDB(): premieredate = premieredatelist[0] else: premieredate = None - - path = "plugin://plugin.video.emby/tvshows/" + MBitem["Id"] + "/" + + #create toplevel path as monitored source - needed for things like actors and stuff to work (no clue why) + if addon.getSetting('useDirectPaths')=='true': + playurl = MBitem["Path"].replace("\\\\", "smb://").replace("\\", "/") + #make sure that the path always ends with a slash + path = utils.convertEncoding(playurl + "/") + toplevelpathstr = path.rsplit("/",2)[1] + toplevelpath = path.replace(toplevelpathstr + "/","") + else: + path = "plugin://plugin.video.emby/tvshows/" + MBitem["Id"] + "/" + toplevelpath = "plugin://plugin.video.emby/" #### ADD THE TV SHOW TO KODI ############## if showid == None: @@ -469,9 +478,6 @@ class WriteKodiVideoDB(): pathid = pathid + 1 pathsql="insert into path(idPath, strPath, strContent, strScraper, noUpdate) values(?, ?, ?, ?, ?)" cursor.execute(pathsql, (pathid,path,None,None,1)) - - #create toplevel path as monitored source - needed for things like actors and stuff to work (no clue why) - toplevelpath = "plugin://plugin.video.emby/" cursor.execute("SELECT idPath as tlpathid FROM path WHERE strPath = ?",(toplevelpath,)) result = cursor.fetchone() if result == None: