Option to use direct paths

This commit is contained in:
xnappo 2015-05-25 09:23:46 -05:00
parent c25c2fc1bb
commit 54a647d866
3 changed files with 53 additions and 17 deletions

View file

@ -209,12 +209,8 @@
<string id="30212">Enable Theme Videos (Requires Restart)</string>
<string id="30213"> - Loop Theme Videos</string>
<string id="30214">Disable forced view</string>
<string id="30215">Enable Fast Processing</string>
<string id="30216">AutoPlay remaining episodes in a season</string>
<string id="30217">Show boxsets collapsed in views (Requires Restart)</string>
<string id="30218">Compress Artwork</string>
<string id="30219">Enable Skin Helper (Requires Restart)</string>
<string id="30220">Latest </string>
<string id="30221">In Progress </string>
<string id="30222">NextUp </string>
@ -226,13 +222,6 @@
<string id="30227">Random Movies</string>
<string id="30228">Random Episodes</string>
<string id="30229">Skin Compatibility Warning</string>
<string id="30230">Your current skin is not fully compatible.</string>
<string id="30231">For a better experience use a skin from the forum.</string>
<string id="30232">http://tinyurl.com/knfus2x</string>
<string id="30233">Don't Show Skin Compatibility Message</string>
<string id="30234">Add Show Name (Season + Episode)</string>
<string id="30235">Extras</string>
<string id="30236">Sync Theme Music</string>
<string id="30237">Sync Extra Fanart</string>
@ -249,6 +238,7 @@
<string id="30247"> - The number of seconds before the end to show the notification</string>
<string id="30248">Show Emby Info dialog on play/select action</string>
<string id="30249">Suppress server connection message at boot</string>
<string id="30250">Use local paths instead of addon redirect (faster playback, but no remote access)</string>
<!-- Default views -->

View file

@ -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,))

View file

@ -18,6 +18,7 @@
<!-- <setting id="syncMovieBoxSets" type="bool" label="30238" default="true" visible="true" enable="true" /> -->
<setting id="dbSyncIndication" type="bool" label="Show sync progress on screen" default="false" visible="true" enable="true" />
<setting id="enableMusicSync" type="bool" label="Enable Music Library Sync" default="false" visible="true" enable="true" />
<setting id="useDirectPaths" type="bool" label="30250" default="false" visible="true" enable="true" />
</category>
<category label="Playback"> <!-- Extra Sync options -->
<setting id="smbusername" type="text" label="30007" default="" visible="true" enable="true" />