mirror of
https://github.com/krateng/maloja.git
synced 2025-06-12 05:12:06 +03:00
Update get_scrobble parameters
This commit is contained in:
parent
85bb1f36cc
commit
6893fd745a
@ -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()
|
||||||
|
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user