Hi,
For several months now, tidal-dl-ng and derivatives have had a broken search. Today, I decided to investigate and (surprisingly quickly) narrowed it down to what seems like a bug in the python-tidal project. For reference, tidal-dl-ng threw this exception:
File "tidal_dl_ng/helper/tidal.py", line 130, in search_results_all
result[key] += value
TypeError: unsupported operand type(s) for +=: 'Track' and 'Track'
Unlike specified in tidalapi.session.SearchResults [1], tidalapi.session.search no longer returns the topHit property as an Optional[List[Any]], but instead as an Optional[Any]. I don't know if this was intended or is the result of a change to the internal Tidal-Api.
Making tidalapi.session.search wrap result["top_hit"] in a list fixes the issue [2].
# Find the type of the top hit so we can parse it
if json_obj["topHit"]:
top_type = json_obj["topHit"]["type"].lower()
parse = self.convert_type(top_type, output="parse")
result["top_hit"] = self.request.map_json(
json_obj["topHit"]["value"], cast(Callable[..., Any], parse)
)
if not isinstance(result["top_hit"], list): result["top_hit"] = [result["top_hit"]] # the fix
I hope this helps resolve the issue. I'm not sure what the desired behavior is and if adding my little hack would be fine for you.
[1] https://github.com/EbbLabs/python-tidal/blob/main/tidalapi/session.py#L207-L213
[2] https://github.com/EbbLabs/python-tidal/blob/main/tidalapi/session.py#L820-L826
Hi,
For several months now,
tidal-dl-ngand derivatives have had a broken search. Today, I decided to investigate and (surprisingly quickly) narrowed it down to what seems like a bug in thepython-tidalproject. For reference,tidal-dl-ngthrew this exception:Unlike specified in
tidalapi.session.SearchResults[1],tidalapi.session.searchno longer returns thetopHitproperty as anOptional[List[Any]], but instead as anOptional[Any]. I don't know if this was intended or is the result of a change to the internal Tidal-Api.Making
tidalapi.session.searchwrapresult["top_hit"]in a list fixes the issue [2].I hope this helps resolve the issue. I'm not sure what the desired behavior is and if adding my little hack would be fine for you.
[1] https://github.com/EbbLabs/python-tidal/blob/main/tidalapi/session.py#L207-L213
[2] https://github.com/EbbLabs/python-tidal/blob/main/tidalapi/session.py#L820-L826