mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Implemented scrobble deletion
This commit is contained in:
parent
8d111b6de7
commit
a142804bfe
@ -403,4 +403,4 @@ def get_export(**keys):
|
||||
@api.post("delete_scrobble")
|
||||
@authenticated_api
|
||||
def delete_scrobble(timestamp):
|
||||
pass
|
||||
database.remove_scrobble(timestamp)
|
||||
|
@ -133,6 +133,11 @@ def incoming_scrobble(rawscrobble,fix=True,client=None,api=None,dbconn=None):
|
||||
|
||||
|
||||
|
||||
@waitfordb
|
||||
def remove_scrobble(timestamp):
|
||||
result = sqldb.delete_scrobble(timestamp)
|
||||
dbcache.invalidate_caches(timestamp)
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -266,6 +266,16 @@ def add_scrobbles(scrobbleslist,dbconn=None):
|
||||
if errors > 0: log(f"{errors} Scrobbles have not been written to database!",color='red')
|
||||
return success,errors
|
||||
|
||||
@connection_provider
|
||||
def delete_scrobble(scrobble_id,dbconn=None):
|
||||
|
||||
with SCROBBLE_LOCK:
|
||||
|
||||
op = DB['scrobbles'].delete().where(
|
||||
DB['scrobbles'].c.timestamp == scrobble_id
|
||||
)
|
||||
|
||||
dbconn.execute(op)
|
||||
|
||||
### these will 'get' the ID of an entity, creating it if necessary
|
||||
|
||||
|
@ -7,4 +7,6 @@ function toggleDeleteConfirm(element) {
|
||||
function deleteScrobble(id,element) {
|
||||
element.parentElement.parentElement.parentElement.classList.add('removed');
|
||||
|
||||
neo.xhttpreq("/apis/mlj_1/delete_scrobble",data={'timestamp':id},method="POST",callback=(()=>null),json=true);
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user