mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Added web interface to audit library data
This commit is contained in:
45
website/issues.html
Normal file
45
website/issues.html
Normal file
@@ -0,0 +1,45 @@
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Maloja - Issues</title>
|
||||
<link rel="stylesheet" href="maloja.css" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<table class="top_info">
|
||||
<tr>
|
||||
|
||||
<td class="text">
|
||||
<h1>Possible Issues</h1><br/>
|
||||
<span>with your library</span>
|
||||
<p class="stats"><a href="/scrobbles?artist=KEY_ENC_ARTISTNAME">KEY_ISSUES Issues</a></p>
|
||||
|
||||
<p>Maloja can identify possible problems with consistency or redundancy in your library.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
KEY_ISSUESLIST
|
||||
|
||||
</body>
|
||||
|
||||
<script>
|
||||
function newrule() {
|
||||
keys = ""
|
||||
for (var i = 1; i < arguments.length; i++) {
|
||||
keys += encodeURIComponent(arguments[i]) + "&"
|
||||
}
|
||||
console.log(keys)
|
||||
var xhttp = new XMLHttpRequest();
|
||||
xhttp.open("POST","/db/newrule?", true);
|
||||
xhttp.send(keys);
|
||||
e = arguments[0]
|
||||
line = e.parentNode
|
||||
line.parentNode.removeChild(line)
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
</html>
|
||||
39
website/issues.py
Normal file
39
website/issues.py
Normal file
@@ -0,0 +1,39 @@
|
||||
import urllib
|
||||
import json
|
||||
from utilities import artistLink
|
||||
|
||||
def replacedict(keys,dbport):
|
||||
|
||||
response = urllib.request.urlopen("http://localhost:" + str(dbport) + "/issues")
|
||||
db_data = json.loads(response.read())
|
||||
i = 0
|
||||
|
||||
html = "<table>"
|
||||
for d in db_data["duplicates"]:
|
||||
html += "<tr>"
|
||||
html += "<td>'" + artistLink(d[0]) + "'"
|
||||
html += " is a possible duplicate of "
|
||||
html += "'" + artistLink(d[1]) + "'</td>"
|
||||
html += """<td class='button' onclick="newrule(this,'replaceartist','""" + d[0] + """','""" + d[1] + """')">""" + d[1] + """ is correct</td>"""
|
||||
html += """<td class='button' onclick="newrule(this,'replaceartist','""" + d[1] + """','""" + d[0] + """')">""" + d[0] + """ is correct</td>"""
|
||||
html += "</tr>"
|
||||
i += 1
|
||||
for c in db_data["combined"]:
|
||||
html += "<tr>"
|
||||
html += "<td>'" + artistLink(c[0]) + "' sounds like the combination of " + str(len(c[1])) + " artists: "
|
||||
for a in c[1]:
|
||||
html += "'" + artistLink(a) + "' "
|
||||
html += "</td>"
|
||||
html += """<td class='button' onclick="newrule(this,'replaceartist','""" + c[0] + """','""" + "␟".join(c[1]) + """')">Fix it</td>"""
|
||||
html += "</tr>"
|
||||
i += 1
|
||||
for n in db_data["newartists"]:
|
||||
html += "<tr>"
|
||||
html += "<td>Is '" + n[0] + "' in '" + artistLink(n[1]) + "' an artist?</td>"
|
||||
html += """<td class='button' onclick="newrule(this,'replaceartist','""" + n[1] + """','""" + "␟".join(n[2] + [n[0]]) + """')">Yes</td>"""
|
||||
html += "</tr>"
|
||||
i += 1
|
||||
|
||||
html += "</table>"
|
||||
|
||||
return {"KEY_ISSUESLIST":html,"KEY_ISSUES":str(i)}
|
||||
@@ -55,3 +55,12 @@ table td.time {
|
||||
table td.artists,td.artist,td.title,td.amount {
|
||||
width:300px;
|
||||
}
|
||||
|
||||
table td.button {
|
||||
width:150px;
|
||||
background-color:yellow;
|
||||
color:#333337;
|
||||
padding:1px;
|
||||
border-radius:4px;
|
||||
cursor:pointer;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user