mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Can now reparse without reloading
This commit is contained in:
parent
2c31df3c58
commit
9c6c91f594
@ -708,7 +708,8 @@ def reparse_scrobble(timestamp):
|
|||||||
if result:
|
if result:
|
||||||
return {
|
return {
|
||||||
"status":"success",
|
"status":"success",
|
||||||
"desc":f"Scrobble was reparsed!"
|
"desc":f"Scrobble was reparsed!",
|
||||||
|
"scrobble":result
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
return {
|
return {
|
||||||
|
@ -118,7 +118,9 @@ def reparse_scrobble(timestamp):
|
|||||||
# check if id changed
|
# check if id changed
|
||||||
if sqldb.get_track_id(scrobble['track']) != track_id:
|
if sqldb.get_track_id(scrobble['track']) != track_id:
|
||||||
sqldb.edit_scrobble(timestamp, {'track':newscrobble['track']})
|
sqldb.edit_scrobble(timestamp, {'track':newscrobble['track']})
|
||||||
return True
|
dbcache.invalidate_entity_cache()
|
||||||
|
dbcache.invalidate_caches()
|
||||||
|
return sqldb.get_scrobble(timestamp=timestamp)
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -525,6 +525,7 @@ table.list tr {
|
|||||||
background-color: var(--current-bg-color);
|
background-color: var(--current-bg-color);
|
||||||
border-color: var(--current-bg-color);
|
border-color: var(--current-bg-color);
|
||||||
height: 1.45em;
|
height: 1.45em;
|
||||||
|
transition: opacity 2s;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -674,6 +675,13 @@ table.list tr.removed {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
table.list tr.changed {
|
||||||
|
/*background-color: rgba(222,209,180,0.7) !important;*/
|
||||||
|
opacity:0;
|
||||||
|
transition: opacity 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
table td.artists div {
|
table td.artists div {
|
||||||
overflow:hidden;
|
overflow:hidden;
|
||||||
|
@ -43,7 +43,11 @@ function reparseScrobble(id, element) {
|
|||||||
callback_func = function(req){
|
callback_func = function(req){
|
||||||
if (req.status == 200) {
|
if (req.status == 200) {
|
||||||
if (req.response.status != 'no_operation') {
|
if (req.response.status != 'no_operation') {
|
||||||
window.location.reload();
|
//window.location.reload();
|
||||||
|
notifyCallback(req);
|
||||||
|
var newtrack = req.response.scrobble.track;
|
||||||
|
var row = element.parentElement.parentElement.parentElement.parentElement;
|
||||||
|
changeScrobbleRow(row,newtrack);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
notifyCallback(req);
|
notifyCallback(req);
|
||||||
@ -58,6 +62,43 @@ function reparseScrobble(id, element) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function changeScrobbleRow(element,newtrack) {
|
||||||
|
element.classList.add('changed');
|
||||||
|
|
||||||
|
setTimeout(function(){
|
||||||
|
element.getElementsByClassName('track')[0].innerHTML = createTrackCell(newtrack);
|
||||||
|
},200);
|
||||||
|
setTimeout(function(){element.classList.remove('changed')},300);
|
||||||
|
}
|
||||||
|
|
||||||
|
function createTrackCell(trackinfo) {
|
||||||
|
|
||||||
|
var trackquery = new URLSearchParams();
|
||||||
|
trackinfo.artists.forEach((a)=>trackquery.append('artist',a));
|
||||||
|
trackquery.append('title',trackinfo.title);
|
||||||
|
|
||||||
|
tracklink = document.createElement('a');
|
||||||
|
tracklink.href = "/track?" + trackquery.toString();
|
||||||
|
tracklink.textContent = trackinfo.title;
|
||||||
|
|
||||||
|
artistelements = []
|
||||||
|
var artistholder = document.createElement('span');
|
||||||
|
artistholder.classList.add('artist_in_trackcolumn');
|
||||||
|
for (var a of trackinfo.artists) {
|
||||||
|
var artistquery = new URLSearchParams();
|
||||||
|
artistquery.append('artist',a);
|
||||||
|
|
||||||
|
artistlink = document.createElement('a');
|
||||||
|
artistlink.href = "/artist?" + artistquery.toString();
|
||||||
|
artistlink.textContent = a;
|
||||||
|
|
||||||
|
artistelements.push(artistlink.outerHTML)
|
||||||
|
}
|
||||||
|
|
||||||
|
artistholder.innerHTML = artistelements.join(", ");
|
||||||
|
return artistholder.outerHTML + " – " + tracklink.outerHTML;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// EDIT NAME
|
// EDIT NAME
|
||||||
function editEntity() {
|
function editEntity() {
|
||||||
|
Loading…
Reference in New Issue
Block a user