mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Added script to fix existing database with new rules
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
<td class="text">
|
||||
<h1>KEY_ARTISTNAME</h1> <span class="stats">KEY_POSITION</span><br/>
|
||||
<span>KEY_ASSOCIATED</span>
|
||||
<p class="stats">KEY_SCROBBLES Scrobbles</p>
|
||||
<p class="stats"><a href="/scrobbles?artist=KEY_ENC_ARTISTNAME">KEY_SCROBBLES Scrobbles</a></p>
|
||||
|
||||
<p>KEY_DESCRIPTION</p>
|
||||
</td>
|
||||
|
||||
@@ -31,11 +31,11 @@ def replacedict(keys,dbport):
|
||||
db_data = json.loads(response.read())
|
||||
tracks = []
|
||||
for e in db_data["list"]:
|
||||
html = "<td>"
|
||||
html = "<td class='artists'>"
|
||||
for a in e["artists"]:
|
||||
html += "<a href=/artist?artist=" + urllib.parse.quote(a) + ">" + a + "</a>, "
|
||||
html = html[:-2]
|
||||
html += "</td><td>" + e["title"] + "</td>"
|
||||
html += "</td><td class='title'>" + e["title"] + "</td>"
|
||||
tracks.append(html)
|
||||
|
||||
trackshtml = "<table>"
|
||||
@@ -46,4 +46,4 @@ def replacedict(keys,dbport):
|
||||
trackshtml += "</table>"
|
||||
|
||||
|
||||
return {"KEY_ARTISTNAME":keys["artist"],"KEY_IMAGEURL":imgurl,"KEY_DESCRIPTION":desc,"KEY_TRACKLIST":trackshtml,"KEY_SCROBBLES":scrobbles,"KEY_POSITION":pos,"KEY_ASSOCIATED":includestr}
|
||||
return {"KEY_ARTISTNAME":keys["artist"],"KEY_ENC_ARTISTNAME":urllib.parse.quote(keys["artist"]),"KEY_IMAGEURL":imgurl, "KEY_DESCRIPTION":desc,"KEY_TRACKLIST":trackshtml,"KEY_SCROBBLES":scrobbles,"KEY_POSITION":pos,"KEY_ASSOCIATED":includestr}
|
||||
|
||||
@@ -43,3 +43,15 @@ table.top_info td.text h1 {
|
||||
table.top_info td.text .stats {
|
||||
color:grey;
|
||||
}
|
||||
|
||||
table tr:nth-child(even) {
|
||||
background-color:#37373B;
|
||||
}
|
||||
|
||||
table td.time {
|
||||
width:200px;
|
||||
color:lightgray;
|
||||
}
|
||||
table td.artists,td.artist,td.title,td.amount {
|
||||
width:300px;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ def replacedict(keys,dbport):
|
||||
|
||||
limitstring = ""
|
||||
if keys.get("artist") is not None:
|
||||
limitstring += "by " + keys.get("artist") + " "
|
||||
limitstring += "by <a href='/artist?artist=" + urllib.parse.quote(keys.get("artist")) + "'>" + keys.get("artist") + "</a> "
|
||||
|
||||
|
||||
response = urllib.request.urlopen("http://localhost:" + str(dbport) + "/scrobbles?" + extrakeys)
|
||||
@@ -26,15 +26,15 @@ def replacedict(keys,dbport):
|
||||
|
||||
html = "<table>"
|
||||
for s in scrobbles:
|
||||
html += "<tr><td>"
|
||||
html += "<tr><td class='time'>"
|
||||
timestring = getTimeDesc(s["time"])
|
||||
html += timestring
|
||||
html += "</td><td>"
|
||||
html += "</td><td class='artists'>"
|
||||
artisthtml = ""
|
||||
for a in s["artists"]:
|
||||
artisthtml += "<a href=/artist?artist=" + urllib.parse.quote(a) + ">" + a + "</a>, "
|
||||
html += artisthtml[:-2]
|
||||
html += "</td><td>" + s["title"] + "</td></tr>"
|
||||
html += "</td><td class='title'>" + s["title"] + "</td></tr>"
|
||||
html += "</table>"
|
||||
|
||||
return {"KEY_SCROBBLELIST":html,"KEY_SCROBBLES":str(len(scrobbles)),"KEY_IMAGEURL":imgurl,"KEY_LIMITS":limitstring}
|
||||
|
||||
@@ -27,9 +27,9 @@ def replacedict(keys,dbport):
|
||||
|
||||
html = "<table>"
|
||||
for e in charts:
|
||||
html += "<tr><td>"
|
||||
html += "<tr><td class='artist'>"
|
||||
html += "<a href=/artist?artist=" + urllib.parse.quote(e["artist"]) + ">" + e["artist"] + "</a>"
|
||||
html += "</td><td>" + str(e["scrobbles"]) + "</td></tr>"
|
||||
html += "</td><td class='amount'><a href='/scrobbles?artist=" + urllib.parse.quote(e["artist"]) + "&" + extrakeys + "'>" + str(e["scrobbles"]) + "</a></td></tr>"
|
||||
html += "</table>"
|
||||
|
||||
return {"KEY_TOPARTIST_IMAGEURL":imgurl,"KEY_SCROBBLES":str(scrobbles),"KEY_ARTISTLIST":html}
|
||||
|
||||
Reference in New Issue
Block a user