diff --git a/maloja/apis/native_v1.py b/maloja/apis/native_v1.py index 5fa05e6..e3ca23f 100644 --- a/maloja/apis/native_v1.py +++ b/maloja/apis/native_v1.py @@ -57,6 +57,11 @@ def get_scrobbles_external(**keys): ckeys = {**k_filter, **k_time, **k_amount} result = get_scrobbles(**ckeys) + + offset = (k_amount.get('page') * k_amount.get('perpage')) if k_amount.get('perpage') is not math.inf else 0 + result = result[offset:] + if k_amount.get('perpage') is not math.inf: result = result[:k_amount.get('perpage')] + return {"list":result} diff --git a/maloja/database.py b/maloja/database.py index 7830dac..c058dd8 100644 --- a/maloja/database.py +++ b/maloja/database.py @@ -269,9 +269,9 @@ def api_key_correct(request): def get_scrobbles(**keys): r = db_query(**{k:keys[k] for k in keys if k in ["artist","artists","title","since","to","within","timerange","associated","track"]}) - offset = (keys.get('page') * keys.get('perpage')) if keys.get('perpage') is not math.inf else 0 - r = r[offset:] - if keys.get('perpage') is not math.inf: r = r[:keys.get('perpage')] + #offset = (keys.get('page') * keys.get('perpage')) if keys.get('perpage') is not math.inf else 0 + #r = r[offset:] + #if keys.get('perpage') is not math.inf: r = r[:keys.get('perpage')] return r