mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-10 04:06:11 +00:00
add api_key to streaming urls
This commit is contained in:
parent
7a9bbcc708
commit
5322058652
3 changed files with 15 additions and 1 deletions
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<addon id="plugin.video.emby"
|
||||
name="Emby"
|
||||
version="2.3.47"
|
||||
version="2.3.48"
|
||||
provider-name="Emby.media">
|
||||
<requires>
|
||||
<import addon="xbmc.python" version="2.19.0"/>
|
||||
|
|
|
@ -53,6 +53,11 @@ 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
|
||||
|
||||
def add_server(self, server, ssl):
|
||||
# Reserved for userclient only
|
||||
server_id = server['Id']
|
||||
|
|
|
@ -72,12 +72,14 @@ class PlayUtils():
|
|||
log.info("Could not get file path for embyfilename window prop")
|
||||
|
||||
playurl = None
|
||||
user_token = downloadutils.DownloadUtils().get_token()
|
||||
|
||||
if (self.item.get('Type') in ("Recording", "TvChannel") and self.item.get('MediaSources')
|
||||
and self.item['MediaSources'][0]['Protocol'] == "Http"):
|
||||
# Play LiveTV or recordings
|
||||
log.info("File protocol is http (livetv).")
|
||||
playurl = "%s/emby/Videos/%s/stream.ts?audioCodec=copy&videoCodec=copy" % (self.server, self.item['Id'])
|
||||
playurl += "&api_key=" + str(user_token)
|
||||
window('emby_%s.playmethod' % playurl, value="DirectPlay")
|
||||
|
||||
|
||||
|
@ -123,6 +125,8 @@ class PlayUtils():
|
|||
else:
|
||||
playurl = "%s/emby/Videos/%s/stream?static=true" % (self.server, itemid)
|
||||
|
||||
user_token = downloadutils.DownloadUtils().get_token()
|
||||
playurl += "&api_key=" + str(user_token)
|
||||
return playurl
|
||||
|
||||
def isDirectPlay(self):
|
||||
|
@ -273,6 +277,8 @@ class PlayUtils():
|
|||
else:
|
||||
playurl = "%s/emby/Videos/%s/stream?static=true" % (self.server, self.item['Id'])
|
||||
|
||||
user_token = downloadutils.DownloadUtils().get_token()
|
||||
playurl += "&api_key=" + str(user_token)
|
||||
return playurl
|
||||
|
||||
def isNetworkSufficient(self):
|
||||
|
@ -319,6 +325,9 @@ class PlayUtils():
|
|||
if transcodeHi10P == "true":
|
||||
playurl = "%s&MaxVideoBitDepth=8" % playurl
|
||||
|
||||
user_token = downloadutils.DownloadUtils().get_token()
|
||||
playurl += "&api_key=" + str(user_token)
|
||||
|
||||
return playurl
|
||||
|
||||
def getBitrate(self):
|
||||
|
|
Loading…
Reference in a new issue