From 54a647d8669ce42320b1e6c4d0dec4efe64d942e Mon Sep 17 00:00:00 2001 From: xnappo Date: Mon, 25 May 2015 09:23:46 -0500 Subject: [PATCH] Option to use direct paths --- resources/language/English/strings.xml | 12 +----- resources/lib/WriteKodiVideoDB.py | 57 +++++++++++++++++++++++--- resources/settings.xml | 1 + 3 files changed, 53 insertions(+), 17 deletions(-) diff --git a/resources/language/English/strings.xml b/resources/language/English/strings.xml index 023b37d4..e68d05e9 100644 --- a/resources/language/English/strings.xml +++ b/resources/language/English/strings.xml @@ -209,12 +209,8 @@ Enable Theme Videos (Requires Restart) - Loop Theme Videos - Disable forced view - Enable Fast Processing AutoPlay remaining episodes in a season - Show boxsets collapsed in views (Requires Restart) Compress Artwork - Enable Skin Helper (Requires Restart) Latest In Progress NextUp @@ -226,13 +222,6 @@ Random Movies Random Episodes - Skin Compatibility Warning - Your current skin is not fully compatible. - For a better experience use a skin from the forum. - http://tinyurl.com/knfus2x - Don't Show Skin Compatibility Message - Add Show Name (Season + Episode) - Extras Sync Theme Music Sync Extra Fanart @@ -249,6 +238,7 @@ - The number of seconds before the end to show the notification Show Emby Info dialog on play/select action Suppress server connection message at boot + Use local paths instead of addon redirect (faster playback, but no remote access) diff --git a/resources/lib/WriteKodiVideoDB.py b/resources/lib/WriteKodiVideoDB.py index 5d2a6cae..dc8d83cc 100644 --- a/resources/lib/WriteKodiVideoDB.py +++ b/resources/lib/WriteKodiVideoDB.py @@ -138,8 +138,23 @@ class WriteKodiVideoDB(): #### ADD OR UPDATE THE FILE AND PATH ########### #### NOTE THAT LASTPLAYED AND PLAYCOUNT ARE STORED AT THE FILE ENTRY - path = "plugin://plugin.video.emby/movies/%s/" % MBitem["Id"] - filename = "plugin://plugin.video.emby/movies/%s/?id=%s&mode=play" % (MBitem["Id"],MBitem["Id"]) + if addon.getSetting('useDirectPaths')=='true': + if PlayUtils().isDirectPlay(MBitem): + playurl = PlayUtils().directPlay(MBitem) + #use the direct file path + if "\\" in playurl: + filename = playurl.rsplit("\\",1)[-1] + path = playurl.replace(filename,"") + elif "/" in playurl: + filename = playurl.rsplit("/",1)[-1] + path = playurl.replace(filename,"") + else: + #for transcoding we just use the server's streaming path because I couldn't figure out how to set the plugin path in the music DB + path = server + "/Audio/%s/" %MBitem["Id"] + filename = "stream.mp3" + else: + path = "plugin://plugin.video.emby/movies/%s/" % MBitem["Id"] + filename = "plugin://plugin.video.emby/movies/%s/?id=%s&mode=play" % (MBitem["Id"],MBitem["Id"]) #create the path cursor.execute("SELECT idPath as pathid FROM path WHERE strPath = ?",(path,)) @@ -287,8 +302,23 @@ class WriteKodiVideoDB(): #### ADD OR UPDATE THE FILE AND PATH ########### #### NOTE THAT LASTPLAYED AND PLAYCOUNT ARE STORED AT THE FILE ENTRY - path = "plugin://plugin.video.emby/musicvideos/%s/" % MBitem["Id"] - filename = "plugin://plugin.video.emby/musicvideos/%s/?id=%s&mode=play" % (MBitem["Id"], MBitem["Id"]) + if addon.getSetting('useDirectPaths')=='true': + if PlayUtils().isDirectPlay(MBitem): + playurl = PlayUtils().directPlay(MBitem) + #use the direct file path + if "\\" in playurl: + filename = playurl.rsplit("\\",1)[-1] + path = playurl.replace(filename,"") + elif "/" in playurl: + filename = playurl.rsplit("/",1)[-1] + path = playurl.replace(filename,"") + else: + #for transcoding we just use the server's streaming path because I couldn't figure out how to set the plugin path in the music DB + path = server + "/Audio/%s/" %MBitem["Id"] + filename = "stream.mp3" + else: + path = "plugin://plugin.video.emby/movies/%s/" % MBitem["Id"] + filename = "plugin://plugin.video.emby/movies/%s/?id=%s&mode=play" % (MBitem["Id"],MBitem["Id"]) #create the path cursor.execute("SELECT idPath as pathid FROM path WHERE strPath = ?",(path,)) @@ -569,8 +599,23 @@ class WriteKodiVideoDB(): #### ADD OR UPDATE THE FILE AND PATH ########### #### NOTE THAT LASTPLAYED AND PLAYCOUNT ARE STORED AT THE FILE ENTRY - path = "plugin://plugin.video.emby/tvshows/" + MBitem["SeriesId"] + "/" - filename = "plugin://plugin.video.emby/tvshows/" + MBitem["SeriesId"] + "/?id=" + MBitem["Id"] + "&mode=play" + if addon.getSetting('useDirectPaths')=='true': + if PlayUtils().isDirectPlay(MBitem): + playurl = PlayUtils().directPlay(MBitem) + #use the direct file path + if "\\" in playurl: + filename = playurl.rsplit("\\",1)[-1] + path = playurl.replace(filename,"") + elif "/" in playurl: + filename = playurl.rsplit("/",1)[-1] + path = playurl.replace(filename,"") + else: + #for transcoding we just use the server's streaming path because I couldn't figure out how to set the plugin path in the music DB + path = server + "/Audio/%s/" %MBitem["Id"] + filename = "stream.mp3" + else: + path = "plugin://plugin.video.emby/movies/%s/" % MBitem["Id"] + filename = "plugin://plugin.video.emby/movies/%s/?id=%s&mode=play" % (MBitem["Id"],MBitem["Id"]) #create the new path - return id if already exists cursor.execute("SELECT idPath as pathid FROM path WHERE strPath = ?",(path,)) diff --git a/resources/settings.xml b/resources/settings.xml index e224696f..acf99ee3 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -18,6 +18,7 @@ +