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

Implemented pulse

This commit is contained in:
krateng 2022-01-07 04:38:41 +01:00
parent 02ddeb4dc0
commit c120850d42

View File

@ -154,12 +154,13 @@ def get_charts_tracks(**keys):
result = sqldb.count_scrobbles_by_track(since=since,to=to) result = sqldb.count_scrobbles_by_track(since=since,to=to)
return result return result
@waitfordb
def get_pulse(**keys): def get_pulse(**keys):
rngs = ranges(**{k:keys[k] for k in keys if k in ["since","to","within","timerange","step","stepn","trail"]}) rngs = ranges(**{k:keys[k] for k in keys if k in ["since","to","within","timerange","step","stepn","trail"]})
results = [] results = []
for rng in rngs: for rng in rngs:
res = len(db_query(timerange=rng,**{k:keys[k] for k in keys if k in ["artists","artist","track","title","associated"]})) res = get_scrobbles_num(timerange=rng,**{k:keys[k] for k in keys if k != 'timerange'})
results.append({"range":rng,"scrobbles":res}) results.append({"range":rng,"scrobbles":res})
return results return results