mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Reworked artwork grabbing
This commit is contained in:
@@ -9,7 +9,7 @@ def replacedict(keys,dbport):
|
||||
clean(keys)
|
||||
info = getArtistInfo(keys["artist"])
|
||||
imgurl = info.get("image")
|
||||
desc = info.get("info")
|
||||
#desc = info.get("info")
|
||||
|
||||
response = urllib.request.urlopen("http://localhost:" + str(dbport) + "/artistinfo?artist=" + urllib.parse.quote(keys["artist"]))
|
||||
db_data = json.loads(response.read())
|
||||
@@ -39,9 +39,9 @@ def replacedict(keys,dbport):
|
||||
html += "<td class='artists'>" + artistLinks(e["track"]["artists"]) + "</td>"
|
||||
html += "<td>" + trackLink(e["track"]) + "</td>"
|
||||
html += "<td class='amount'>" + scrobblesTrackLink(e["track"],{},amount=e["scrobbles"]) + "</td>"
|
||||
html += "<td class='bar'>" + scrobblesTrackLink(e["track"],{},pixels=e["scrobbles"]*100/maxbar) + "</td>"
|
||||
html += "<td class='bar'>" + scrobblesTrackLink(e["track"],{},percent=e["scrobbles"]*100/maxbar) + "</td>"
|
||||
html += "</tr>"
|
||||
html += "</table>"
|
||||
|
||||
|
||||
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}
|
||||
return {"KEY_ARTISTNAME":keys["artist"],"KEY_ENC_ARTISTNAME":urllib.parse.quote(keys["artist"]),"KEY_IMAGEURL":imgurl, "KEY_DESCRIPTION":"","KEY_TRACKLIST":html,"KEY_SCROBBLES":scrobbles,"KEY_POSITION":pos,"KEY_ASSOCIATED":includestr}
|
||||
|
||||
@@ -79,19 +79,31 @@ table.list tr td {
|
||||
|
||||
}
|
||||
|
||||
table tr:nth-child(even) {
|
||||
table.list tr:nth-child(even) {
|
||||
background-color:#37373B;
|
||||
}
|
||||
|
||||
table tr:nth-child(5n) td {
|
||||
table.list tr:nth-child(5n) td {
|
||||
border-color:rgba(120,120,120,0.2);
|
||||
|
||||
}
|
||||
|
||||
table.list tr:hover {
|
||||
background-color:#404044;
|
||||
}
|
||||
|
||||
table td.time {
|
||||
width:200px;
|
||||
width:180px;
|
||||
color:gray;
|
||||
}
|
||||
|
||||
table td.icon {
|
||||
width:20px;
|
||||
height:20px;
|
||||
background-size:cover;
|
||||
background-position:center;
|
||||
}
|
||||
|
||||
table td.artists,td.artist,td.title {
|
||||
width:500px;
|
||||
white-space:nowrap;
|
||||
|
||||
@@ -45,6 +45,7 @@ def replacedict(keys,dbport):
|
||||
for s in scrobbles:
|
||||
html += "<tr>"
|
||||
html += "<td class='time'>" + getTimeDesc(s["time"]) + "</td>"
|
||||
#html += """<td class='icon' style="background-image:url('""" + getArtistInfo(s["artists"][0]).get("image") + """')" /></td>"""
|
||||
html += "<td class='artists'>" + artistLinks(s["artists"]) + "</td>"
|
||||
html += "<td class='title'>" + trackLink({"artists":s["artists"],"title":s["title"]}) + "</td>"
|
||||
html += "</tr>"
|
||||
|
||||
@@ -3,12 +3,12 @@ import json
|
||||
|
||||
|
||||
def replacedict(keys,dbport):
|
||||
from utilities import getArtistInfo
|
||||
from utilities import getArtistInfo, getTrackInfo
|
||||
from htmlgenerators import clean, artistLink, artistLinks, trackLink, scrobblesTrackLink, keysToUrl, pickKeys, getTimeDesc
|
||||
|
||||
clean(keys)
|
||||
limitkeys = pickKeys(keys,"artist","title")
|
||||
info = getArtistInfo(keys["artist"])
|
||||
info = getTrackInfo(keys.getall("artist"),keys.get("title"))
|
||||
imgurl = info.get("image")
|
||||
desc = info.get("info")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user