Fix parse error in uri parser when track in name (#1218)
authorMarcel van der Veldt <m.vanderveldt@outlook.com>
Thu, 11 Apr 2024 19:15:20 +0000 (21:15 +0200)
committerGitHub <noreply@github.com>
Thu, 11 Apr 2024 19:15:20 +0000 (21:15 +0200)
music_assistant/common/helpers/uri.py

index 8c6bc90e16c89c28a36fcf84c62595419729fc7d..f789d86bb52ac602fc8d33cccb7eef44b6634482 100644 (file)
@@ -44,10 +44,9 @@ async def parse_uri(uri: str, validate_id: bool = False) -> tuple[MediaType, str
         elif "://" in uri and len(uri.split("/")) >= 4:
             # music assistant-style uri
             # provider://media_type/item_id
-            provider_instance_id_or_domain = uri.split("://")[0]
-            media_type_str = uri.split("/")[2]
+            provider_instance_id_or_domain, rest = uri.split("://", 1)
+            media_type_str, item_id = rest.split("/", 1)
             media_type = MediaType(media_type_str)
-            item_id = uri.split(f"{media_type_str}/")[1]
         elif ":" in uri:
             # spotify new-style uri
             provider_instance_id_or_domain, media_type_str, item_id = uri.split(":")