mirror of
https://github.com/home-assistant/core.git
synced 2025-07-10 06:47:09 +00:00
kodi fanart fix basic auth (#4930)
This commit is contained in:
parent
1d60760e21
commit
7bb0abdf09
@ -76,11 +76,17 @@ class KodiDevice(MediaPlayerDevice):
|
|||||||
import jsonrpc_requests
|
import jsonrpc_requests
|
||||||
self._name = name
|
self._name = name
|
||||||
self._url = url
|
self._url = url
|
||||||
|
self._basic_auth_url = None
|
||||||
|
|
||||||
kwargs = {'timeout': 5}
|
kwargs = {'timeout': 5}
|
||||||
|
|
||||||
if auth is not None:
|
if auth is not None:
|
||||||
kwargs['auth'] = auth
|
kwargs['auth'] = auth
|
||||||
|
scheme, netloc, path, query, fragment = urllib.parse.urlsplit(url)
|
||||||
|
self._basic_auth_url = \
|
||||||
|
urllib.parse.urlunsplit((scheme, '{}:{}@{}'.format
|
||||||
|
(auth[0], auth[1], netloc),
|
||||||
|
path, query, fragment))
|
||||||
|
|
||||||
self._server = jsonrpc_requests.Server(
|
self._server = jsonrpc_requests.Server(
|
||||||
'{}/jsonrpc'.format(self._url), **kwargs)
|
'{}/jsonrpc'.format(self._url), **kwargs)
|
||||||
@ -195,6 +201,11 @@ class KodiDevice(MediaPlayerDevice):
|
|||||||
url_components = urllib.parse.urlparse(self._item['thumbnail'])
|
url_components = urllib.parse.urlparse(self._item['thumbnail'])
|
||||||
|
|
||||||
if url_components.scheme == 'image':
|
if url_components.scheme == 'image':
|
||||||
|
if self._basic_auth_url is not None:
|
||||||
|
return '{}/image/{}'.format(
|
||||||
|
self._basic_auth_url,
|
||||||
|
urllib.parse.quote_plus(self._item['thumbnail']))
|
||||||
|
|
||||||
return '{}/image/{}'.format(
|
return '{}/image/{}'.format(
|
||||||
self._url,
|
self._url,
|
||||||
urllib.parse.quote_plus(self._item['thumbnail']))
|
urllib.parse.quote_plus(self._item['thumbnail']))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user