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

Added pictures to #1 history view

This commit is contained in:
Krateng 2019-04-02 14:41:18 +02:00
parent c68f69abc2
commit 6d76d323f0

View File

@ -167,7 +167,7 @@ def module_artistcharts(max_=None,**kwargs):
def module_toptracks(**kwargs):
def module_toptracks(pictures=True,**kwargs):
kwargs_filter = pickKeys(kwargs,"artist","associated")
kwargs_time = pickKeys(kwargs,"since","to","within","step","stepn","trail")
@ -194,11 +194,15 @@ def module_toptracks(**kwargs):
html += "<td>" + range_desc(e["from"],e["to"],short=True) + "</td>"
if e["track"] is None:
if pictures:
html += "<td><div></div></td>"
html += "<td class='stats'>" + "No scrobbles" + "</td>"
html += "<td>" + "" + "</td>"
html += "<td class='amount'>" + "0" + "</td>"
html += "<td class='bar'>" + "" + "</td>"
else:
if pictures:
html += """<td class='icon'><div style="background-image:url('""" + getTrackImage(e["track"]["artists"],e["track"]["title"],fast=True) + """')"></div></td>"""
html += "<td class='artists'>" + artistLinks(e["track"]["artists"]) + "</td>"
html += "<td class='title'>" + trackLink(e["track"]) + "</td>"
html += "<td class='amount'>" + scrobblesTrackLink(e["track"],{"since":fromstr,"to":tostr},amount=e["scrobbles"]) + "</td>"
@ -209,7 +213,7 @@ def module_toptracks(**kwargs):
return (html,representative)
def module_topartists(**kwargs):
def module_topartists(pictures=True,**kwargs):
kwargs_time = pickKeys(kwargs,"since","to","within","step","stepn","trail")
@ -234,11 +238,16 @@ def module_topartists(**kwargs):
html += "<td>" + range_desc(e["from"],e["to"],short=True) + "</td>"
if e["artist"] is None:
if pictures:
html += "<td><div></div></td>"
html += "<td class='stats'>" + "No scrobbles" + "</td>"
html += "<td class='amount'>" + "0" + "</td>"
html += "<td class='bar'>" + "" + "</td>"
else:
if pictures:
html += """<td class='icon'><div style="background-image:url('""" + getArtistImage(e["artist"],fast=True) + """')"></div></td>"""
html += "<td class='artist'>" + artistLink(e["artist"])
if (e["counting"] != []):
html += " <span class='extra'>incl. " + ", ".join([artistLink(a) for a in e["counting"]]) + "</span>"