Simplify params handling for endpoints

This commit is contained in:
François Charette 2020-12-05 21:49:00 +01:00
parent 6aa3f5fb0f
commit 902c5b8ee2

View File

@ -43,10 +43,6 @@ class Client:
params = {"track_id": kwargs["id"]} params = {"track_id": kwargs["id"]}
elif epoint == "album/get": elif epoint == "album/get":
params = {"album_id": kwargs["id"]} params = {"album_id": kwargs["id"]}
elif epoint == "track/search":
params = {"query": kwargs["query"], "limit": kwargs["limit"]}
elif epoint == "album/search":
params = {"query": kwargs["query"], "limit": kwargs["limit"]}
elif epoint == "playlist/get": elif epoint == "playlist/get":
params = { params = {
"extra": "tracks", "extra": "tracks",
@ -94,6 +90,8 @@ class Client:
"format_id": fmt_id, "format_id": fmt_id,
"intent": "stream", "intent": "stream",
} }
else:
params=kwargs
r = self.session.get(self.base + epoint, params=params) r = self.session.get(self.base + epoint, params=params)
# Do ref header. # Do ref header.
if epoint == "user/login": if epoint == "user/login":