mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 05:37:44 +00:00
1) artwork_url might be a relative url (such as /imageproxy). in that case, join it with the base url. note: urllib.parse.urljoin will handle case when the artwork url is absolute. 2) artwork would not be replaced in the user interface because the url did not change between tracks (http://.../cover.jpg). solved by appending internal hash of the media title to the url to force reload
This commit is contained in:
parent
4f2dc3cc2a
commit
54f65ae87d
@ -201,11 +201,18 @@ class SqueezeBoxDevice(MediaPlayerDevice):
|
|||||||
def media_image_url(self):
|
def media_image_url(self):
|
||||||
""" Image url of current playing media. """
|
""" Image url of current playing media. """
|
||||||
if 'artwork_url' in self._status:
|
if 'artwork_url' in self._status:
|
||||||
return self._status['artwork_url']
|
media_url = self._status['artwork_url']
|
||||||
return ('http://{server}:{port}/music/current/cover.jpg?'
|
else:
|
||||||
'player={player}').format(server=self._lms.host,
|
media_url = ('/music/current/cover.jpg?'
|
||||||
port=self._lms.http_port,
|
'player={player}&'
|
||||||
player=self._id)
|
'nocache={nocache}').format(
|
||||||
|
player=self._id,
|
||||||
|
nocache=hash(self.media_title))
|
||||||
|
|
||||||
|
base_url = 'http://{server}:{port}/'.format(server=self._lms.host,
|
||||||
|
port=self._lms.http_port)
|
||||||
|
|
||||||
|
return urllib.parse.urljoin(base_url, media_url)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def media_title(self):
|
def media_title(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user