From 41fa61ada9059837c837f94bbe55ff8be08d135b Mon Sep 17 00:00:00 2001 From: angelblue05 Date: Thu, 20 Aug 2015 20:51:54 -0500 Subject: [PATCH] Revert "Take into account item type for direct stream" This reverts commit 53fbbffa75c6d875d5d33cc30bc52464251c9d62. --- resources/lib/Entrypoint.py | 2 +- resources/lib/PlayUtils.py | 20 ++++++++++++-------- resources/lib/PlaybackUtils.py | 3 +-- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/resources/lib/Entrypoint.py b/resources/lib/Entrypoint.py index ed038f4c..6e10a414 100644 --- a/resources/lib/Entrypoint.py +++ b/resources/lib/Entrypoint.py @@ -204,7 +204,7 @@ def getThemeMedia(): if playback == "DirectPlay": playurl = playUtils.directPlay(theme) else: - playurl = playUtils.directStream(result, server, theme[u'Id'], "Video") + playurl = playUtils.directStream(result, server, theme[u'Id'], "ThemeVideo") pathstowrite += ('%s' % playurl.encode('utf-8')) # Check if the item has theme songs and add them diff --git a/resources/lib/PlayUtils.py b/resources/lib/PlayUtils.py index 882a9a68..3c291790 100644 --- a/resources/lib/PlayUtils.py +++ b/resources/lib/PlayUtils.py @@ -31,17 +31,12 @@ class PlayUtils(): className = self.__class__.__name__ 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 username = WINDOW.getProperty('currUser') server = WINDOW.getProperty('server%s' % username) - if "Audio" in type: - type = "Audio" - else: - type = "Video" - if self.isDirectPlay(result,True): # Try direct play playurl = self.directPlay(result) @@ -51,7 +46,7 @@ class PlayUtils(): elif self.isDirectStream(result): # Try direct stream - playurl = self.directStream(result, server, id, type) + playurl = self.directStream(result, server, id) if playurl: self.logMsg("File is direct streaming.", 1) WINDOW.setProperty("%splaymethod" % playurl, "DirectStream") @@ -166,8 +161,17 @@ class PlayUtils(): def directStream(self, result, server, id, type = "Video"): try: - if "Video" in type: + if "ThemeVideo" in type: 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: playurl = "%s/mediabrowser/Audio/%s/stream.mp3" % (server, id) diff --git a/resources/lib/PlaybackUtils.py b/resources/lib/PlaybackUtils.py index 98468be4..f61510e7 100644 --- a/resources/lib/PlaybackUtils.py +++ b/resources/lib/PlaybackUtils.py @@ -46,7 +46,6 @@ class PlaybackUtils(): try: id = result["Id"] - type = result['Type'] except: return @@ -91,7 +90,7 @@ class PlaybackUtils(): # Let's play the playlist 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": WINDOW.clearProperty('playurlFalse') xbmc.log("Failed to retrieve the playback path/url.")