Revert "Take into account item type for direct stream"

This reverts commit 53fbbffa75.
This commit is contained in:
angelblue05 2015-08-20 20:51:54 -05:00
parent afa582057a
commit 41fa61ada9
3 changed files with 14 additions and 11 deletions

View File

@ -204,7 +204,7 @@ def getThemeMedia():
if playback == "DirectPlay": if playback == "DirectPlay":
playurl = playUtils.directPlay(theme) playurl = playUtils.directPlay(theme)
else: else:
playurl = playUtils.directStream(result, server, theme[u'Id'], "Video") playurl = playUtils.directStream(result, server, theme[u'Id'], "ThemeVideo")
pathstowrite += ('<file>%s</file>' % playurl.encode('utf-8')) pathstowrite += ('<file>%s</file>' % playurl.encode('utf-8'))
# Check if the item has theme songs and add them # Check if the item has theme songs and add them

View File

@ -31,17 +31,12 @@ class PlayUtils():
className = self.__class__.__name__ className = self.__class__.__name__
utils.logMsg("%s %s" % (self.addonName, className), msg, int(lvl)) utils.logMsg("%s %s" % (self.addonName, className), msg, int(lvl))
def getPlayUrl(self, server, id, result, type): def getPlayUrl(self, server, id, result):
WINDOW = self.WINDOW WINDOW = self.WINDOW
username = WINDOW.getProperty('currUser') username = WINDOW.getProperty('currUser')
server = WINDOW.getProperty('server%s' % username) server = WINDOW.getProperty('server%s' % username)
if "Audio" in type:
type = "Audio"
else:
type = "Video"
if self.isDirectPlay(result,True): if self.isDirectPlay(result,True):
# Try direct play # Try direct play
playurl = self.directPlay(result) playurl = self.directPlay(result)
@ -51,7 +46,7 @@ class PlayUtils():
elif self.isDirectStream(result): elif self.isDirectStream(result):
# Try direct stream # Try direct stream
playurl = self.directStream(result, server, id, type) playurl = self.directStream(result, server, id)
if playurl: if playurl:
self.logMsg("File is direct streaming.", 1) self.logMsg("File is direct streaming.", 1)
WINDOW.setProperty("%splaymethod" % playurl, "DirectStream") WINDOW.setProperty("%splaymethod" % playurl, "DirectStream")
@ -166,9 +161,18 @@ class PlayUtils():
def directStream(self, result, server, id, type = "Video"): def directStream(self, result, server, id, type = "Video"):
try: try:
if "Video" in type: if "ThemeVideo" in type:
playurl ="%s/mediabrowser/Videos/%s/stream?static=true" % (server, id) playurl ="%s/mediabrowser/Videos/%s/stream?static=true" % (server, id)
elif "Video" in type:
playurl = "%s/mediabrowser/Videos/%s/stream?static=true" % (server, id)
# Verify audio and subtitles
mediaSources = result[u'MediaSources']
if mediaSources[0].get('DefaultAudioStreamIndex') != None:
playurl = "%s&AudioStreamIndex=%s" % (playurl, mediaSources[0].get('DefaultAudioStreamIndex'))
if mediaSources[0].get('DefaultSubtitleStreamIndex') != None:
playurl = "%s&SubtitleStreamIndex=%s" % (playurl, mediaSources[0].get('DefaultSubtitleStreamIndex'))
elif "Audio" in type: elif "Audio" in type:
playurl = "%s/mediabrowser/Audio/%s/stream.mp3" % (server, id) playurl = "%s/mediabrowser/Audio/%s/stream.mp3" % (server, id)

View File

@ -46,7 +46,6 @@ class PlaybackUtils():
try: try:
id = result["Id"] id = result["Id"]
type = result['Type']
except: except:
return return
@ -91,7 +90,7 @@ class PlaybackUtils():
# Let's play the playlist # Let's play the playlist
return self.AddToPlaylist(itemsToPlay) return self.AddToPlaylist(itemsToPlay)
playurl = PlayUtils().getPlayUrl(server, id, result, type) playurl = PlayUtils().getPlayUrl(server, id, result)
if playurl == False or WINDOW.getProperty('playurlFalse') == "true": if playurl == False or WINDOW.getProperty('playurlFalse') == "true":
WINDOW.clearProperty('playurlFalse') WINDOW.clearProperty('playurlFalse')
xbmc.log("Failed to retrieve the playback path/url.") xbmc.log("Failed to retrieve the playback path/url.")