mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Database can now analyze consistency of scrobble data
This commit is contained in:
@@ -40,6 +40,13 @@
|
||||
line.parentNode.removeChild(line)
|
||||
|
||||
}
|
||||
|
||||
function fullrebuild() {
|
||||
var xhttp = new XMLHttpRequest();
|
||||
xhttp.open("POST","/db/rebuild", true);
|
||||
xhttp.send()
|
||||
window.location = "/wait";
|
||||
}
|
||||
|
||||
</script>
|
||||
</html>
|
||||
|
||||
@@ -9,6 +9,12 @@ def replacedict(keys,dbport):
|
||||
i = 0
|
||||
|
||||
html = "<table>"
|
||||
if db_data["inconsistent"]:
|
||||
html += "<tr>"
|
||||
html += "<td>The current database wasn't built with all current rules in effect. Any problem below might be a false alarm and fixing it could create redundant rules.</td>"
|
||||
html += """<td class='button important' onclick="fullrebuild()">Rebuild the database</td>"""
|
||||
html += "</tr>"
|
||||
i += 1
|
||||
for d in db_data["duplicates"]:
|
||||
html += "<tr>"
|
||||
html += "<td>'" + artistLink(d[0]) + "'"
|
||||
|
||||
@@ -60,7 +60,12 @@ table td.button {
|
||||
width:200px;
|
||||
background-color:yellow;
|
||||
color:#333337;
|
||||
padding:1px;
|
||||
padding:4px;
|
||||
border-radius:4px;
|
||||
cursor:pointer;
|
||||
}
|
||||
|
||||
td.button.important {
|
||||
background-color:red;
|
||||
color:white;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ def replacedict(keys,dbport):
|
||||
from utilities import getArtistInfo
|
||||
|
||||
#hand down the since and from arguments
|
||||
extrakeys = urllib.parse.urlencode(keys)
|
||||
extrakeys = urllib.parse.urlencode(keys,quote_via=urllib.parse.quote,safe="/")
|
||||
|
||||
response = urllib.request.urlopen("http://localhost:" + str(dbport) + "/charts/artists?" + extrakeys)
|
||||
db_data = json.loads(response.read())
|
||||
|
||||
56
website/wait.html
Normal file
56
website/wait.html
Normal file
@@ -0,0 +1,56 @@
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Maloja - Please wait</title>
|
||||
<link rel="stylesheet" href="maloja.css" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<table class="top_info">
|
||||
<tr>
|
||||
|
||||
<td class="text">
|
||||
<h1>Maloja</h1><br/>
|
||||
<span>Redbuilding the database</span>
|
||||
|
||||
<p>Please wait...</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
<script>
|
||||
var pending = false;
|
||||
setInterval(probeServer,1500);
|
||||
|
||||
function probeServer() {
|
||||
if (!pending) {
|
||||
console.log("Probing...");
|
||||
pending = true;
|
||||
var xhttp = new XMLHttpRequest();
|
||||
xhttp.open("GET","/db/test", true);
|
||||
xhttp.onreadystatechange = goback;
|
||||
xhttp.send();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function goback() {
|
||||
if ((this.readyState == 4) && (this.status == 205)) {
|
||||
console.log("Not ready yet!")
|
||||
pending = false;
|
||||
}
|
||||
if ((this.readyState == 4) && (this.status == 204)) {
|
||||
console.log("K");
|
||||
pending = false;
|
||||
window.location = "/issues";
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
</html>
|
||||
Reference in New Issue
Block a user