1
0
mirror of https://github.com/krateng/maloja.git synced 2023-08-10 21:12:55 +03:00

Organizing

This commit is contained in:
Krateng 2019-02-16 16:28:32 +01:00
parent 208d059743
commit 8f2ea10be2

View File

@ -174,7 +174,18 @@ def get_scrobbles(**keys):
# DEPRECATED, merge with /amounts
# DEPRECATED
# UNUSED
@dbserver.route("/amounts")
def get_amounts_external():
return get_amounts() #really now
def get_amounts():
return {"scrobbles":len(SCROBBLES),"tracks":len(TRACKS),"artists":len(ARTISTS)}
@dbserver.route("/numscrobbles")
def get_scrobbles_num_external():
keys = FormsDict.decode(request.query)
@ -190,6 +201,22 @@ def get_scrobbles_num(**keys):
r = db_query(**{k:keys[k] for k in keys if k in ["artists","title","since","to","within","associated"]})
return len(r)
# DEPRECATED
# UNUSED
@dbserver.route("/charts")
def get_charts_external():
keys = FormsDict.decode(request.query)
ckeys = {}
ckeys["since"], ckeys["to"], ckeys["within"] = keys.get("since"), keys.get("to"), keys.get("in")
result = get_scrobbles_num(**ckeys)
return {"number":result}
#def get_charts(**keys):
# return db_aggregate(**{k:keys[k] for k in keys if k in ["since","to","within"]})
@ -229,13 +256,6 @@ def get_artists():
@dbserver.route("/amounts")
def get_amounts_external():
return get_amounts() #really now
def get_amounts():
return {"scrobbles":len(SCROBBLES),"tracks":len(TRACKS),"artists":len(ARTISTS)}
@ -275,23 +295,6 @@ def get_charts_tracks(**keys):
# DEPRECATED, merge with /amounts
@dbserver.route("/charts")
def get_charts_external():
keys = FormsDict.decode(request.query)
ckeys = {}
ckeys["since"], ckeys["to"], ckeys["within"] = keys.get("since"), keys.get("to"), keys.get("in")
result = get_charts(**ckeys)
return {"number":result}
def get_charts(**keys):
return db_aggregate(**{k:keys[k] for k in keys if k in ["since","to","within"]})