mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Fixed race condition in search
This commit is contained in:
parent
b161da1c1a
commit
1eae55e3bb
@ -5,7 +5,7 @@ author = {
|
||||
"email":"maloja@krateng.dev",
|
||||
"github": "krateng"
|
||||
}
|
||||
version = 2,6,0
|
||||
version = 2,6,1
|
||||
versionstr = ".".join(str(n) for n in version)
|
||||
links = {
|
||||
"pypi":"malojaserver",
|
||||
|
@ -145,6 +145,7 @@ replaceartist 여자친구 GFriend GFriend
|
||||
|
||||
# Girl's Generation
|
||||
replaceartist 소녀시대 Girls' Generation
|
||||
replaceartist SNSD Girls' Generation
|
||||
|
||||
# Apink
|
||||
replaceartist A Pink Apink
|
||||
@ -162,6 +163,11 @@ replacetitle 달라달라 (DALLA DALLA) Dalla Dalla
|
||||
# K/DA
|
||||
belongtogether K/DA
|
||||
|
||||
# 2NE1
|
||||
countas CL 2NE1
|
||||
|
||||
# WJSN
|
||||
replaceartist Cosmic Girls WJSN
|
||||
|
||||
# Popular Remixes
|
||||
artistintitle Areia Remix Areia
|
||||
|
Can't render this file because it has a wrong number of fields in line 5.
|
@ -1,4 +1,4 @@
|
||||
|
||||
var searches = []
|
||||
|
||||
function search(searchfield) {
|
||||
txt = searchfield.value;
|
||||
@ -7,6 +7,7 @@ function search(searchfield) {
|
||||
}
|
||||
else {
|
||||
xhttp = new XMLHttpRequest();
|
||||
searches.push(xhttp)
|
||||
xhttp.onreadystatechange = searchresult
|
||||
xhttp.open("GET","/api/search?max=5&query=" + encodeURIComponent(txt), true);
|
||||
xhttp.send();
|
||||
@ -45,8 +46,9 @@ const oneresult = html_to_fragment(resulthtml).firstElementChild;
|
||||
|
||||
|
||||
function searchresult() {
|
||||
if (this.readyState == 4 && this.status == 200 && document.getElementById("searchinput").value != "") {
|
||||
// checking if field is empty in case we get an old result coming in that would overwrite our cleared result window
|
||||
if (this.readyState == 4 && this.status == 200 && document.getElementById("searchinput").value != "" && searches.includes(this)) {
|
||||
// any older searches are now rendered irrelevant
|
||||
while (searches[0] != this) { searches.splice(0,1) }
|
||||
var result = JSON.parse(this.responseText);
|
||||
var artists = result["artists"].slice(0,5)
|
||||
var tracks = result["tracks"].slice(0,5)
|
||||
|
1
maloja/thirdparty/musicbrainz.py
vendored
1
maloja/thirdparty/musicbrainz.py
vendored
@ -57,7 +57,6 @@ class MusicBrainz(MetadataInterface):
|
||||
return self.metadata_parse_response_track(data)
|
||||
|
||||
except:
|
||||
raise
|
||||
return None
|
||||
finally:
|
||||
time.sleep(2)
|
||||
|
Loading…
Reference in New Issue
Block a user