mirror of
https://github.com/home-assistant/core.git
synced 2025-07-09 14:27:07 +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
|
||||
self._name = name
|
||||
self._url = url
|
||||
self._basic_auth_url = None
|
||||
|
||||
kwargs = {'timeout': 5}
|
||||
|
||||
if auth is not None:
|
||||
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(
|
||||
'{}/jsonrpc'.format(self._url), **kwargs)
|
||||
@ -195,6 +201,11 @@ class KodiDevice(MediaPlayerDevice):
|
||||
url_components = urllib.parse.urlparse(self._item['thumbnail'])
|
||||
|
||||
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(
|
||||
self._url,
|
||||
urllib.parse.quote_plus(self._item['thumbnail']))
|
||||
|
Loading…
x
Reference in New Issue
Block a user