Autoresume in-progress items from Plex media browser (#68494)

This commit is contained in:
jjlawren 2022-03-29 04:08:26 -05:00 committed by GitHub
parent d4ab48a049
commit 112d232c2e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 58 additions and 6 deletions

View file

@ -112,6 +112,7 @@ def process_plex_payload(
) -> PlexMediaSearchResult:
"""Look up Plex media using media_player.play_media service payloads."""
plex_server = default_plex_server
extra_params = {}
if content_id.startswith(PLEX_URI_SCHEME + "{"):
# Handle the special payload of 'plex://{<json>}'
@ -132,6 +133,7 @@ def process_plex_payload(
else:
# Handle legacy payloads without server_id in URL host position
content = int(plex_url.host) # type: ignore[arg-type]
extra_params = dict(plex_url.query)
else:
content = json.loads(content_id)
@ -152,6 +154,8 @@ def process_plex_payload(
content = {"plex_key": content}
content_type = DOMAIN
content.update(extra_params)
if playqueue_id := content.pop("playqueue_id", None):
if not supports_playqueues:
raise HomeAssistantError("Plex playqueues are not supported on this device")