diff --git a/cleanup.py b/cleanup.py index 91f72da..83b8e4d 100644 --- a/cleanup.py +++ b/cleanup.py @@ -23,11 +23,11 @@ class CleanerAgent: artists = self.parseArtists(self.removespecial(artist)) title = self.parseTitle(self.removespecial(title)) (title,moreartists) = self.parseTitleForArtists(title) - artists += moreartists - + artists += moreartists + artists = list(set(artists)) artists.sort() - return (list(set(artists)),title) + return (artists,title) def removespecial(self,s): s = s.replace("\t","").replace("␟","").replace("\n","") diff --git a/fixexisting.py b/fixexisting.py index 8a838cd..b75208e 100644 --- a/fixexisting.py +++ b/fixexisting.py @@ -18,7 +18,6 @@ for fn in os.listdir("scrobbles/"): a = a.replace("␟",";") (al,t) = wendigo.fullclean(a,t) - al.sort() a = "␟".join(al) fnew.write(r1 + a + r2 + t + r3 + "\n") #print("Artists: " + a) diff --git a/website/artist.py b/website/artist.py index 38885fd..002acbe 100644 --- a/website/artist.py +++ b/website/artist.py @@ -3,7 +3,7 @@ import json def replacedict(keys,dbport): - from utilities import getArtistInfo + from utilities import getArtistInfo, artistLink info = getArtistInfo(keys["artist"]) @@ -18,32 +18,28 @@ def replacedict(keys,dbport): credited = db_data.get("replace") includestr = " " if credited is not None: - includestr = "Competing under " + credited + " (" + pos + ")" + includestr = "Competing under " + artistLink(credited) + " (" + pos + ")" pos = "" included = db_data.get("associated") if included is not None and included != []: includestr = "associated: " - for a in included: - includestr += "" + a + ", " - includestr = includestr[:-2] + #for a in included: + includestr += ", ".join([artistLink(a) for a in included]) #"" + a + ", " + #includestr = includestr[:-2] response = urllib.request.urlopen("http://localhost:" + str(dbport) + "/tracks?artist=" + urllib.parse.quote(keys["artist"])) db_data = json.loads(response.read()) - tracks = [] - for e in db_data["list"]: - html = "" - for a in e["artists"]: - html += "" + a + ", " - html = html[:-2] - html += "" + e["title"] + "" - tracks.append(html) - trackshtml = "" - for t in tracks: - trackshtml += "" - trackshtml += t - trackshtml += "" - trackshtml += "
" + html = "" + for e in db_data["list"]: + html += "" + html += "" + html += "" + html += "
" + links = [artistLink(a) for a in e["artists"]] + html += ", ".join(links) + html += "" + e["title"] + "
" + - 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} + return {"KEY_ARTISTNAME":keys["artist"],"KEY_ENC_ARTISTNAME":urllib.parse.quote(keys["artist"]),"KEY_IMAGEURL":imgurl, "KEY_DESCRIPTION":desc,"KEY_TRACKLIST":html,"KEY_SCROBBLES":scrobbles,"KEY_POSITION":pos,"KEY_ASSOCIATED":includestr} diff --git a/website/issues.py b/website/issues.py index 34a5101..0ae1614 100644 --- a/website/issues.py +++ b/website/issues.py @@ -12,7 +12,7 @@ def replacedict(keys,dbport): if db_data["inconsistent"]: html += "" html += "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." - html += """Rebuild the database""" + html += """
Rebuild the database
""" html += "" i += 1 for d in db_data["duplicates"]: @@ -20,8 +20,8 @@ def replacedict(keys,dbport): html += "'" + artistLink(d[0]) + "'" html += " is a possible duplicate of " html += "'" + artistLink(d[1]) + "'" - html += """""" + d[1] + """ is correct""" - html += """""" + d[0] + """ is correct""" + html += """
""" + d[1] + """ is correct
""" + html += """
""" + d[0] + """ is correct
""" html += "" i += 1 for c in db_data["combined"]: @@ -30,13 +30,13 @@ def replacedict(keys,dbport): for a in c[1]: html += "'" + artistLink(a) + "' " html += "" - html += """Fix it""" + html += """
Fix it
""" html += "" i += 1 for n in db_data["newartists"]: html += "" html += "Is '" + n[0] + "' in '" + artistLink(n[1]) + "' an artist?" - html += """Yes""" + html += """
Yes
""" html += "" i += 1 diff --git a/website/maloja.css b/website/maloja.css index 0d482b8..83cf0cb 100644 --- a/website/maloja.css +++ b/website/maloja.css @@ -51,12 +51,15 @@ table.top_info td.text .stats { text-align:right; color:grey; } +a { + cursor:pointer; +} table.list { border-collapse:collapse; } -table.list tr { +table.list tr td { border-bottom:2px solid; border-color:rgba(0,0,0,0) @@ -66,7 +69,7 @@ table tr:nth-child(even) { background-color:#37373B; } -table tr:nth-child(5n) { +table tr:nth-child(5n) td { border-color:rgba(120,120,120,0.2); } @@ -83,7 +86,9 @@ table td.amount { text-align:right; } table td.bar { - width:300px; + width:500px; + background-color:#333337; + border-color:rgba(0,0,0,0)!important; } table td.bar div { background-color:beige; @@ -97,14 +102,17 @@ table tr:hover td.bar div { table td.button { width:200px; - background-color:yellow; - color:#333337; - padding:4px; - border-radius:4px; cursor:pointer; } -td.button.important { +table td.button div { + background-color:yellow; + color:#333337; + padding:3px; + border-radius:4px; +} + +td.button.important div { background-color:red; color:white; } diff --git a/website/scrobbles.py b/website/scrobbles.py index 78b8176..b3cddbb 100644 --- a/website/scrobbles.py +++ b/website/scrobbles.py @@ -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 " + keys.get("artist") + " " - + #limitstring += "by " + keys.get("artist") + " " + 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 += "" - artisthtml = "" - for a in s["artists"]: - artisthtml += "" + a + ", " - html += artisthtml[:-2] + html += ", ".join([artistLink(a) for a in s["artists"]]) + #artisthtml = "" + #for a in s["artists"]: + # artisthtml += "" + a + ", " + #html += artisthtml[:-2] html += "" + s["title"] + "" html += "" diff --git a/website/topartists.py b/website/topartists.py index 17ddf95..815fc59 100644 --- a/website/topartists.py +++ b/website/topartists.py @@ -3,7 +3,7 @@ import json def replacedict(keys,dbport): - from utilities import getArtistInfo + from utilities import getArtistInfo, artistLink #hand down the since and from arguments extrakeys = urllib.parse.urlencode(keys,quote_via=urllib.parse.quote,safe="/") @@ -30,9 +30,10 @@ def replacedict(keys,dbport): for e in charts: html += "" html += "#" + str(i) + "" - html += "" + e["artist"] + "" + #html += "" + e["artist"] + "" + html += artistLink(e["artist"]) html += "" + str(e["scrobbles"]) + "" - html += "
" + html += "
" html += "" i += 1 html += ""