Syncing Movie pictures now finally works

Had to add Plex credentials to URL
This commit is contained in:
tomkat83 2015-12-30 16:37:30 +01:00
parent 1e7acfc927
commit f2294569e6

View file

@ -41,6 +41,7 @@ import xbmc
import struct import struct
import time import time
import urllib
import urllib2 import urllib2
import httplib import httplib
import socket import socket
@ -1314,6 +1315,9 @@ class API():
self.item = item self.item = item
self.clientinfo = clientinfo.ClientInfo() self.clientinfo = clientinfo.ClientInfo()
self.addonName = self.clientinfo.getAddonName() self.addonName = self.clientinfo.getAddonName()
self.userId = utils.window('emby_currUser')
self.server = utils.window('emby_server%s' % self.userId)
self.token = utils.window('emby_accessToken%s' % self.userId)
def logMsg(self, msg, lvl=1): def logMsg(self, msg, lvl=1):
@ -1643,6 +1647,13 @@ class API():
return filepath return filepath
def addPlexCredentialsToUrl(self, url, arguments={}):
token = {'X-Plex-Token': self.token}
xargs = PlexAPI().getXArgsDeviceInfo(options=token)
xargs.update(arguments)
url = "%s?%s" % (url, urllib.urlencode(xargs))
return url
def getMediaStreams(self): def getMediaStreams(self):
item = self.item item = self.item
item = item['_children'] item = item['_children']
@ -1721,9 +1732,10 @@ class API():
'subtitle': subtitlelanguages 'subtitle': subtitlelanguages
} }
def getAllArtwork(self, item, parentInfo=False): def getAllArtwork(self, parentInfo=False):
server = self.server server = self.server
item = self.item
id = item['key'] id = item['key']
@ -1753,6 +1765,7 @@ class API():
try: try:
background = item['art'] background = item['art']
background = "%s%s" % (server, background) background = "%s%s" % (server, background)
background = self.addPlexCredentialsToUrl(background)
except KeyError: except KeyError:
background = "" background = ""
allartworks['Backdrop'].append(background) allartworks['Backdrop'].append(background)
@ -1760,6 +1773,7 @@ class API():
try: try:
primary = item['thumb'] primary = item['thumb']
primary = "%s%s" % (server, primary) primary = "%s%s" % (server, primary)
primary = self.addPlexCredentialsToUrl(primary)
except KeyError: except KeyError:
primary = "" primary = ""
allartworks['Primary'] = primary allartworks['Primary'] = primary
@ -1815,4 +1829,4 @@ class API():
% (server, parentId, maxWidth, maxHeight, parentTag, customquery)) % (server, parentId, maxWidth, maxHeight, parentTag, customquery))
allartworks['Primary'] = artwork allartworks['Primary'] = artwork
return allartworks return allartworks