mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
First test separation of API get and actual function
This commit is contained in:
parent
4faf9a9490
commit
42833c8d09
@ -138,10 +138,12 @@ def test_server():
|
|||||||
# 403 Database server is up, but provided API key is not valid
|
# 403 Database server is up, but provided API key is not valid
|
||||||
|
|
||||||
@dbserver.route("/scrobbles")
|
@dbserver.route("/scrobbles")
|
||||||
def get_scrobbles():
|
def get_scrobbles_external():
|
||||||
keys = FormsDict.decode(request.query)
|
keys = FormsDict.decode(request.query)
|
||||||
|
return get_scrobbles(artists=keys.getall("artist"),title=keys.get("title"),since=keys.get("since"),to=keys.get("to"),within=keys.get("in"),associated=(keys.get("associated")!=None),max=keys.get("max"))
|
||||||
|
|
||||||
r = db_query(artists=keys.getall("artist"),title=keys.get("title"),since=keys.get("since"),to=keys.get("to"),within=keys.get("in"),associated=(keys.get("associated")!=None))
|
def get_scrobbles(**keys):
|
||||||
|
r = db_query(**{k:keys[k] for k in keys if k in ["artists","title","since","to","within","associated"]})
|
||||||
r.reverse()
|
r.reverse()
|
||||||
|
|
||||||
if keys.get("max") is not None:
|
if keys.get("max") is not None:
|
||||||
@ -150,7 +152,7 @@ def get_scrobbles():
|
|||||||
return {"list":r} ##json can't be a list apparently???
|
return {"list":r} ##json can't be a list apparently???
|
||||||
|
|
||||||
@dbserver.route("/numscrobbles")
|
@dbserver.route("/numscrobbles")
|
||||||
def get_scrobbles():
|
def get_scrobbles_num():
|
||||||
keys = FormsDict.decode(request.query)
|
keys = FormsDict.decode(request.query)
|
||||||
|
|
||||||
r = db_query(artists=keys.getall("artist"),title=keys.get("title"),since=keys.get("since"),to=keys.get("to"),within=keys.get("in"),associated=(keys.get("associated")!=None))
|
r = db_query(artists=keys.getall("artist"),title=keys.get("title"),since=keys.get("since"),to=keys.get("to"),within=keys.get("in"),associated=(keys.get("associated")!=None))
|
||||||
|
Loading…
Reference in New Issue
Block a user