Handle Plex searches in URL media_content_id format (#72462)

This commit is contained in:
jjlawren
2022-05-24 22:46:27 -05:00
committed by GitHub
parent b8e9b8f540
commit fbeaf200e4

View File

@@ -123,7 +123,9 @@ def process_plex_payload(
plex_url = URL(content_id)
if plex_url.name:
if len(plex_url.parts) == 2:
# The path contains a single item, will always be a ratingKey
if plex_url.name == "search":
content = {}
else:
content = int(plex_url.name)
else:
# For "special" items like radio stations
@@ -132,6 +134,9 @@ def process_plex_payload(
plex_server = get_plex_server(hass, plex_server_id=server_id)
else:
# Handle legacy payloads without server_id in URL host position
if plex_url.host == "search":
content = {}
else:
content = int(plex_url.host) # type: ignore[arg-type]
extra_params = dict(plex_url.query)
else: