d
This commit is contained in:
@@ -89,11 +89,34 @@ class Tidal(Provider):
|
||||
https://tidal-api.binimum.org.
|
||||
"""
|
||||
|
||||
_stringify = staticmethod(stringify)
|
||||
def _stringify = staticmethod(stringify)
|
||||
_extract_artists = staticmethod(extract_artists)
|
||||
_build_track_tags = staticmethod(build_track_tags)
|
||||
_coerce_duration_seconds = staticmethod(coerce_duration_seconds)
|
||||
|
||||
@property
|
||||
def prefers_transfer_progress(self) -> bool:
|
||||
return True
|
||||
|
||||
def _get_view(self, query: str) -> str:
|
||||
text = str(query or "").strip()
|
||||
if not text:
|
||||
return "track"
|
||||
if re.search(r"\balbum\s*:", text, flags=re.IGNORECASE):
|
||||
return "album"
|
||||
if re.search(r"\bartist\s*:", text, flags=re.IGNORECASE):
|
||||
return "artist"
|
||||
return "track"
|
||||
|
||||
def get_table_type(self, query: str, filters: Optional[Dict[str, Any]] = None) -> str:
|
||||
view = self._get_view(query)
|
||||
return f"tidal.{view}"
|
||||
|
||||
def get_table_metadata(self, query: str, filters: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
|
||||
meta = super().get_table_metadata(query, filters)
|
||||
meta["view"] = self._get_view(query)
|
||||
return meta
|
||||
|
||||
def __init__(self, config: Optional[Dict[str, Any]] = None) -> None:
|
||||
super().__init__(config)
|
||||
self.api_urls = self._resolve_api_urls()
|
||||
|
||||
Reference in New Issue
Block a user