Fix remove playlist tracks (#594)
authorjozefKruszynski <60214390+jozefKruszynski@users.noreply.github.com>
Wed, 29 Mar 2023 18:27:18 +0000 (20:27 +0200)
committerGitHub <noreply@github.com>
Wed, 29 Mar 2023 18:27:18 +0000 (20:27 +0200)
* fix: playlists

Fix GenericAlias error when trying to remove playlist tracks

* fix: playlists

Update according to review comment

* fix review comment

* Fixing review comment

---------

Co-authored-by: jkruszynski <jozef@krush.at>
music_assistant/server/helpers/api.py

index 1533253438b70bae4a444ff60544fdee4694125e..6731b5c80da5656bb3140faa638fabceebf59ebe 100644 (file)
@@ -93,12 +93,12 @@ def parse_value(name: str, value: Any, value_type: Any, default: Any = MISSING)
     if value is None and value_type is NoneType:
         return None
     origin = get_origin(value_type)
-    if origin is list:
-        return [
+    if origin in (tuple, list):
+        return origin(
             parse_value(name, subvalue, get_args(value_type)[0])
             for subvalue in value
             if subvalue is not None
-        ]
+        )
     elif origin is dict:
         subkey_type = get_args(value_type)[0]
         subvalue_type = get_args(value_type)[1]