Correct media flags

This commit is contained in:
angelblue05 2015-07-24 02:52:36 -05:00
parent 9d866f9fc9
commit 335035d6f2
2 changed files with 35 additions and 20 deletions

View file

@ -6,7 +6,7 @@
import sqlite3 import sqlite3
from datetime import datetime from datetime import datetime
from os.path import basename from ntpath import split as ntsplit
import xbmc import xbmc
import xbmcgui import xbmcgui
@ -270,8 +270,11 @@ class WriteKodiMusicDB():
# Get the path and filename # Get the path and filename
playurl = PlayUtils().directPlay(MBitem) playurl = PlayUtils().directPlay(MBitem)
try: try:
filename = basename(playurl) path, filename = ntsplit(playurl)
path = playurl.replace(filename, "") if "\\" in playurl:
path = "%s\\" % path
elif "/" in playurl:
path = "%s/" % path
except: # playurl returned false - using server streaming path, because could not figure out plugin paths for music DB except: # playurl returned false - using server streaming path, because could not figure out plugin paths for music DB
playurl = PlayUtils().directstream(MBitem, self.server, embyId, "Audio") playurl = PlayUtils().directstream(MBitem, self.server, embyId, "Audio")
filename = "stream.mp3" filename = "stream.mp3"

View file

@ -5,7 +5,7 @@
################################################################################################# #################################################################################################
import sqlite3 import sqlite3
from os.path import basename from ntpath import dirname, split as ntsplit
import xbmc import xbmc
import xbmcgui import xbmcgui
@ -142,14 +142,17 @@ class WriteKodiVideoDB():
if "plugin://" in playurl: if "plugin://" in playurl:
fileext = "" fileext = ""
else: else:
fileext = basename(playurl) path, fileext = ntsplit(playurl)
except: return # playurl returned False except: return # playurl returned False
else: # Set filename and path else: # Set filename and path
if self.directpath: if self.directpath:
# Use direct paths instead of add-on redirect # Use direct paths instead of add-on redirect
filename = fileext filename = fileext
path = playurl.replace(filename, "") if "\\" in path:
path = "%s\\" % path
elif "/" in directory:
path = "%s/" % path
else: # Set plugin path and media flags using real filename else: # Set plugin path and media flags using real filename
filename = "plugin://plugin.video.emby/movies/%s/?filename=%s&id=%s&mode=play" % (embyId, fileext, embyId) filename = "plugin://plugin.video.emby/movies/%s/?filename=%s&id=%s&mode=play" % (embyId, fileext, embyId)
@ -320,9 +323,15 @@ class WriteKodiVideoDB():
# playurl can return False # playurl can return False
playurl = PlayUtils().directPlay(MBitem) playurl = PlayUtils().directPlay(MBitem)
try: try:
filename = basename(playurl) path, filename = ntsplit(playurl)
path = playurl.replace(filename, "") if "\\" in path:
except: return# Should we return instead? - 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 = "%s\\" % path
elif "/" in path:
path = "%s/" % path
except:
#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 = "%s/Video/%s/" % (self.server, embyId)
filename = "stream.mp4"
else: # Set plugin path else: # Set plugin path
path = "plugin://plugin.video.emby/musicvideos/%s/" % embyId path = "plugin://plugin.video.emby/musicvideos/%s/" % embyId
filename = "plugin://plugin.video.emby/musicvideos/%s/?id=%s&mode=play" % (embyId, embyId) filename = "plugin://plugin.video.emby/musicvideos/%s/?id=%s&mode=play" % (embyId, embyId)
@ -445,16 +454,16 @@ class WriteKodiVideoDB():
# Set filename and path # Set filename and path
if self.directpath: if self.directpath:
# Network share
playurl = PlayUtils().directPlay(MBitem) playurl = PlayUtils().directPlay(MBitem)
try: # playurl can return False if "/" in playurl:
filename = basename(playurl) # Network path
path = playurl.replace(filename, "") path = "%s/" % playurl
if "\\" in playurl: toplevelpath = "%s/" % dirname(dirname(path))
temp = "%s\\" % path.rsplit("\\", 2)[1] else:
elif "/" in playurl: # Local path
temp = "%s/" % path.rsplit("/", 2)[1] path = "%s\\" % playurl
toplevelpath = path.replace(temp,"") toplevelpath = "%s\\" % dirname(dirname(path))
except: pass
else: # Set plugin path else: # Set plugin path
path = "plugin://plugin.video.emby/tvshows/%s/" % embyId path = "plugin://plugin.video.emby/tvshows/%s/" % embyId
toplevelpath = "plugin://plugin.video.emby/" toplevelpath = "plugin://plugin.video.emby/"
@ -589,13 +598,16 @@ class WriteKodiVideoDB():
if "plugin://" in playurl: if "plugin://" in playurl:
fileext = "" fileext = ""
else: else:
fileext = basename(playurl) path, fileext = ntsplit(playurl)
except: return # playurl returned False except: return # playurl returned False
else: # Set filename and path else: # Set filename and path
if self.directpath: if self.directpath:
filename = fileext filename = fileext
path = playurl.replace(filename, "") if "\\" in playurl:
path = "%s\\" % path
elif "/" in playurl:
path = "%s/" % path
else: # Set plugin path and media flags - real filename with extension else: # Set plugin path and media flags - real filename with extension
filename = "plugin://plugin.video.emby/tvshows/%s/?filename=%s&id=%s&mode=play" % (seriesId, fileext, embyId) filename = "plugin://plugin.video.emby/tvshows/%s/?filename=%s&id=%s&mode=play" % (seriesId, fileext, embyId)