"This will allow Music Assistant to fetch additional metadata from (enabled) "
"metadata providers, such as The Audio DB and Fanart.tv.\n\n"
"Note that these online sources are only queried when no information is already "
- "available from local files or the music providers.\n\n"
+ "available from local files or the music providers and local artwork/metadata "
+ "will always have preference over online sources so consider metadata from online "
+ "sources as complementary only.\n\n"
"The retrieval of additional rich metadata is a process that is executed slowly "
"in the background to not overload these free services with requests. "
"You can speedup the process by storing the images and other metadata locally.",
cls, command: str, func: Callable[..., Coroutine[Any, Any, Any]]
) -> APICommandHandler:
"""Parse APICommandHandler by providing a function."""
+ type_hints = get_type_hints(func)
+ # workaround for generic typevar ItemCls that needs to be resolved
+ # to the real media item type. TODO: find a better way to do this
+ # without this hack
+ for key, value in type_hints.items():
+ if not hasattr(value, "__name__"):
+ continue
+ if value.__name__ == "ItemCls":
+ type_hints[key] = func.__self__.item_cls
return APICommandHandler(
command=command,
signature=inspect.signature(func),
- type_hints=get_type_hints(func),
+ type_hints=type_hints,
target=func,
)
return float(value)
if value_type is int and isinstance(value, str) and value.isnumeric():
return int(value)
+
if not isinstance(value, value_type): # type: ignore[arg-type]
msg = (
f"Value {value} of type {type(value)} is invalid for {name}, "