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 {"status":"success","scrobble":scrobbledict}
return scrobbledict return scrobbledict
@waitfordb @waitfordb
def reparse_scrobble(timestamp): def reparse_scrobble(timestamp):
log(f"Reparsing 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']: if not scrobble or not scrobble['rawscrobble']:
return return
@ -185,6 +186,7 @@ def get_scrobbles(dbconn=None,**keys):
#return result[keys['page']*keys['perpage']:(keys['page']+1)*keys['perpage']] #return result[keys['page']*keys['perpage']:(keys['page']+1)*keys['perpage']]
return list(reversed(result)) return list(reversed(result))
@waitfordb @waitfordb
def get_scrobbles_num(dbconn=None,**keys): def get_scrobbles_num(dbconn=None,**keys):
(since,to) = keys.get('timerange').timestamps() (since,to) = keys.get('timerange').timestamps()

View File

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