mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 13:47:35 +00:00
* Fix for URL encoding problem #102557 Fixes the problem "Cannot play media with spaces in folder names to Sonos #102557" removing the encoding of the strings in the music library. * Fix type casting problem * Update media_browser.py to fix pr check findings Added required casting for all unquote statements to avoid further casting findings in the pr checks * Update media_browser.py Checked on linting, lets give it another try * Update media_browser.py Updated ruff run * Update media_browser.py - added version run through ruff * Update media_browser.py - ruff changes * Apply ruff formatting * Update homeassistant/components/sonos/media_browser.py Co-authored-by: jjlawren <jjlawren@users.noreply.github.com> * Update homeassistant/components/sonos/media_browser.py Co-authored-by: jjlawren <jjlawren@users.noreply.github.com> * Update homeassistant/components/sonos/media_browser.py Co-authored-by: jjlawren <jjlawren@users.noreply.github.com> * Update homeassistant/components/sonos/media_browser.py Co-authored-by: jjlawren <jjlawren@users.noreply.github.com> --------- Co-authored-by: computeq-admin <51021172+computeq-admin@users.noreply.github.com> Co-authored-by: Jason Lawrence <jjlawren@users.noreply.github.com>
This commit is contained in:
parent
8e384ab598
commit
acdb3cc7a2
@ -7,6 +7,7 @@ from contextlib import suppress
|
|||||||
from functools import partial
|
from functools import partial
|
||||||
import logging
|
import logging
|
||||||
from typing import cast
|
from typing import cast
|
||||||
|
import urllib.parse
|
||||||
|
|
||||||
from soco.data_structures import DidlObject
|
from soco.data_structures import DidlObject
|
||||||
from soco.ms_data_structures import MusicServiceItem
|
from soco.ms_data_structures import MusicServiceItem
|
||||||
@ -60,12 +61,14 @@ def get_thumbnail_url_full(
|
|||||||
media_content_id,
|
media_content_id,
|
||||||
media_content_type,
|
media_content_type,
|
||||||
)
|
)
|
||||||
return getattr(item, "album_art_uri", None)
|
return urllib.parse.unquote(getattr(item, "album_art_uri", ""))
|
||||||
|
|
||||||
return get_browse_image_url(
|
return urllib.parse.unquote(
|
||||||
media_content_type,
|
get_browse_image_url(
|
||||||
media_content_id,
|
media_content_type,
|
||||||
media_image_id,
|
media_content_id,
|
||||||
|
media_image_id,
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -166,6 +169,7 @@ def build_item_response(
|
|||||||
payload["idstring"] = "A:ALBUMARTIST/" + "/".join(
|
payload["idstring"] = "A:ALBUMARTIST/" + "/".join(
|
||||||
payload["idstring"].split("/")[2:]
|
payload["idstring"].split("/")[2:]
|
||||||
)
|
)
|
||||||
|
payload["idstring"] = urllib.parse.unquote(payload["idstring"])
|
||||||
|
|
||||||
try:
|
try:
|
||||||
search_type = MEDIA_TYPES_TO_SONOS[payload["search_type"]]
|
search_type = MEDIA_TYPES_TO_SONOS[payload["search_type"]]
|
||||||
@ -496,7 +500,7 @@ def get_media(
|
|||||||
if not item_id.startswith("A:ALBUM") and search_type == SONOS_ALBUM:
|
if not item_id.startswith("A:ALBUM") and search_type == SONOS_ALBUM:
|
||||||
item_id = "A:ALBUMARTIST/" + "/".join(item_id.split("/")[2:])
|
item_id = "A:ALBUMARTIST/" + "/".join(item_id.split("/")[2:])
|
||||||
|
|
||||||
search_term = item_id.split("/")[-1]
|
search_term = urllib.parse.unquote(item_id.split("/")[-1])
|
||||||
matches = media_library.get_music_library_information(
|
matches = media_library.get_music_library_information(
|
||||||
search_type, search_term=search_term, full_album_art_uri=True
|
search_type, search_term=search_term, full_album_art_uri=True
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user