Update theme media

This commit is contained in:
angelblue05 2018-01-09 19:31:14 -06:00
parent 3bccc195da
commit 1ec3b32919
4 changed files with 15 additions and 12 deletions

View file

@ -54,9 +54,7 @@ class DownloadUtils(object):
log.debug("Set info for server %s: %s", self.session['ServerId'], self.session)
def get_token(self):
user = self._get_session_info()
token = user['Token']
return token
return self._get_session_info()['Token']
def add_server(self, server, ssl):
# Reserved for userclient only

View file

@ -548,6 +548,7 @@ def getThemeMedia():
doUtils = downloadutils.DownloadUtils()
dialog = xbmcgui.Dialog()
dummy_listitem = xbmcgui.ListItem()
playback = None
# Choose playback method
@ -613,11 +614,11 @@ def getThemeMedia():
pathstowrite = ""
# May be more than one theme
for theme in result['Items']:
putils = playutils.PlayUtils(theme)
putils = playutils.PlayUtils(theme, dummy_listitem)
if playback == "DirectPlay":
playurl = putils.directPlay()
playurl = api.API(theme).get_file_path()
else:
playurl = putils.directStream()
playurl = putils.get_direct_url(theme['MediaSources'][0])
pathstowrite += ('<file>%s</file>' % playurl.encode('utf-8'))
# Check if the item has theme songs and add them
@ -629,7 +630,7 @@ def getThemeMedia():
if playback == "DirectPlay":
playurl = api.API(theme).get_file_path()
else:
playurl = playutils.PlayUtils(theme).directStream()
playurl = playutils.PlayUtils(theme, dummy_listitem).get_direct_url(theme['MediaSources'][0])
pathstowrite += ('<file>%s</file>' % playurl.encode('utf-8'))
nfo_file.write(
@ -676,7 +677,7 @@ def getThemeMedia():
if playback == "DirectPlay":
playurl = api.API(theme).get_file_path()
else:
playurl = playutils.PlayUtils(theme).directStream()
playurl = playutils.PlayUtils(theme, dummy_listitem).get_direct_url(theme['MediaSources'][0])
pathstowrite += ('<file>%s</file>' % playurl.encode('utf-8'))
nfo_file.write(

View file

@ -88,7 +88,8 @@ class PlaybackUtils(object):
# Stack: [(url, listitem), (url, ...), ...]
self.stack[0][1].setPath(self.stack[0][0])
try:
if not xbmc.getCondVisibility('Window.IsVisible(MyVideoNav.xml)') and not xbmc.getCondVisibility('Window.IsVisible(VideoFullScreen.xml)'):
if (not xbmc.getCondVisibility('Window.IsVisible(MyVideoNav.xml)') and
not xbmc.getCondVisibility('Window.IsVisible(VideoFullScreen.xml)')):
# widgets do not fill artwork correctly
log.info("Detected widget.")
raise IndexError

View file

@ -209,9 +209,6 @@ class PlayUtils():
play_url = self.get_transcode_url(source) if transcode else self.get_direct_url(source)
user_token = downloadutils.DownloadUtils().get_token()
play_url += "&api_key=" + user_token
return play_url
def get_direct_url(self, source):
@ -227,6 +224,9 @@ class PlayUtils():
if settings('enableExternalSubs') == "true":
self.set_external_subs(source, play_url)
user_token = downloadutils.DownloadUtils().get_token()
play_url += "&api_key=" + user_token
return play_url
def get_transcode_url(self, source):
@ -252,6 +252,9 @@ class PlayUtils():
# Select audio and subtitles
play_url += self.get_audio_subs(source)
user_token = downloadutils.DownloadUtils().get_token()
play_url += "&api_key=" + user_token
return play_url
def set_external_subs(self, source, play_url):