Fix URL tokens
This commit is contained in:
parent
9b6cdbafc2
commit
70393b1b86
3 changed files with 15 additions and 3 deletions
|
@ -1773,7 +1773,7 @@ class API():
|
||||||
episode = item['index']
|
episode = item['index']
|
||||||
return key, title, season, episode
|
return key, title, season, episode
|
||||||
|
|
||||||
def addPlexCredentialsToUrl(self, url, arguments={}):
|
def addPlexHeadersToUrl(self, url, arguments={}):
|
||||||
"""
|
"""
|
||||||
Takes an URL and optional arguments (also to be URL-encoded); returns
|
Takes an URL and optional arguments (also to be URL-encoded); returns
|
||||||
an extended URL with e.g. the Plex token included.
|
an extended URL with e.g. the Plex token included.
|
||||||
|
@ -1788,6 +1788,18 @@ class API():
|
||||||
url = "%s&%s" % (url, urlencode(xargs))
|
url = "%s&%s" % (url, urlencode(xargs))
|
||||||
return url
|
return url
|
||||||
|
|
||||||
|
def addPlexCredentialsToUrl(self, url):
|
||||||
|
"""
|
||||||
|
Returns an extended URL with the Plex token included as 'X-Plex-Token='
|
||||||
|
|
||||||
|
url may or may not already contain a '?'
|
||||||
|
"""
|
||||||
|
if '?' not in url:
|
||||||
|
url = "%s?X-Plex-Token=%s" % (url, self.token)
|
||||||
|
else:
|
||||||
|
url = "%s&X-Plex-Token=%s" % (url, self.token)
|
||||||
|
return url
|
||||||
|
|
||||||
def GetPlayQueueItemID(self):
|
def GetPlayQueueItemID(self):
|
||||||
"""
|
"""
|
||||||
Returns current playQueueItemID for the item.
|
Returns current playQueueItemID for the item.
|
||||||
|
|
|
@ -1859,7 +1859,7 @@ class Music(Items):
|
||||||
paths = "%s%s" % (self.server, item[0][0].attrib.get('key'))
|
paths = "%s%s" % (self.server, item[0][0].attrib.get('key'))
|
||||||
paths = paths.rsplit('/', 1)
|
paths = paths.rsplit('/', 1)
|
||||||
path = paths[0] + '/'
|
path = paths[0] + '/'
|
||||||
filename = paths[1] + '?X-Plex-Token=ihfViFUqqJf1vWrchnA9'
|
filename = API.addPlexCredentialsToUrl(paths[1])
|
||||||
# else:
|
# else:
|
||||||
# path = "plugin://plugin.audio.plexkodiconnect.music/"
|
# path = "plugin://plugin.audio.plexkodiconnect.music/"
|
||||||
# filename = API.getKey()
|
# filename = API.getKey()
|
||||||
|
|
|
@ -391,7 +391,7 @@ class PlayUtils():
|
||||||
|
|
||||||
url = "%s/library/streams/%s" \
|
url = "%s/library/streams/%s" \
|
||||||
% (self.server, selectSubsIndex)
|
% (self.server, selectSubsIndex)
|
||||||
url = self.API.addPlexCredentialsToUrl(url)
|
url = self.API.addPlexHeadersToUrl(url)
|
||||||
self.logMsg("Downloadable sub: %s: %s" % (selectSubsIndex, url), 1)
|
self.logMsg("Downloadable sub: %s: %s" % (selectSubsIndex, url), 1)
|
||||||
listitem.setSubtitles([url])
|
listitem.setSubtitles([url])
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue