1
0
mirror of https://github.com/krateng/maloja.git synced 2023-08-10 21:12:55 +03:00

Simplified some of the webpage building logic

This commit is contained in:
Krateng
2018-12-22 12:47:49 +01:00
parent 7465eadf83
commit eb9c9b2f69
7 changed files with 52 additions and 47 deletions

View File

@ -3,7 +3,7 @@ import json
def replacedict(keys,dbport):
from utilities import getArtistInfo, getTimeDesc
from utilities import getArtistInfo, getTimeDesc, artistLink
#hand down the since and from arguments
@ -17,8 +17,8 @@ def replacedict(keys,dbport):
limitstring = ""
if keys.get("artist") is not None:
limitstring += "by <a href='/artist?artist=" + urllib.parse.quote(keys.get("artist")) + "'>" + keys.get("artist") + "</a> "
#limitstring += "by <a href='/artist?artist=" + urllib.parse.quote(keys.get("artist")) + "'>" + keys.get("artist") + "</a> "
limitstring += "by " + artistLink(keys.get("artist"))
response = urllib.request.urlopen("http://localhost:" + str(dbport) + "/scrobbles?" + extrakeys)
db_data = json.loads(response.read())
@ -30,10 +30,11 @@ def replacedict(keys,dbport):
timestring = getTimeDesc(s["time"])
html += timestring
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 += ", ".join([artistLink(a) for a in s["artists"]])
#artisthtml = ""
#for a in s["artists"]:
# artisthtml += "<a href=/artist?artist=" + urllib.parse.quote(a) + ">" + a + "</a>, "
#html += artisthtml[:-2]
html += "</td><td class='title'>" + s["title"] + "</td></tr>"
html += "</table>"