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

Update get_scrobble parameters

This commit is contained in:
alim4r 2022-04-21 18:28:59 +02:00
parent 85bb1f36cc
commit 6893fd745a
2 changed files with 5 additions and 3 deletions

View File

@ -112,10 +112,11 @@ def incoming_scrobble(rawscrobble,fix=True,client=None,api=None,dbconn=None):
#return {"status":"success","scrobble":scrobbledict}
return scrobbledict
@waitfordb
def reparse_scrobble(timestamp):
log(f"Reparsing Scrobble {timestamp}")
scrobble = sqldb.get_scrobble(timestamp)
scrobble = sqldb.get_scrobble(timestamp=timestamp, include_internal=True)
if not scrobble or not scrobble['rawscrobble']:
return
@ -185,6 +186,7 @@ def get_scrobbles(dbconn=None,**keys):
#return result[keys['page']*keys['perpage']:(keys['page']+1)*keys['perpage']]
return list(reversed(result))
@waitfordb
def get_scrobbles_num(dbconn=None,**keys):
(since,to) = keys.get('timerange').timestamps()

View File

@ -704,14 +704,14 @@ def get_artist(id,dbconn=None):
@cached_wrapper
@connection_provider
def get_scrobble(timestamp,dbconn=None):
def get_scrobble(timestamp, include_internal=False, dbconn=None):
op = DB['scrobbles'].select().where(
DB['scrobbles'].c.timestamp==timestamp
)
result = dbconn.execute(op).all()
scrobble = result[0]
return scrobbles_db_to_dict([scrobble], True)[0]
return scrobbles_db_to_dict(rows=[scrobble], include_internal=include_internal)[0]
##### MAINTENANCE