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

Reorganized charts code

This commit is contained in:
Krateng 2019-09-21 20:51:49 +02:00
parent ed62cbfc0b
commit 59e38e24ee
2 changed files with 19 additions and 15 deletions

View File

@ -25,22 +25,23 @@ def instructions(keys):
else:
imgurl = ""
topartists = ""
imgdiv = '<div style="background-image:url('+imgurl+')"></div>'
html_tiles = ""
if get_settings("CHARTS_DISPLAY_TILES"):
topartists = module_artistcharts_tiles(timerange=timekeys["timerange"])
imgdiv = """<div style="background-image:url('favicon.png')"></div>"""
html_tiles = module_artistcharts_tiles(timerange=timekeys["timerange"])
imgurl = "favicon.png"
imgdiv = '<div style="background-image:url('+imgurl+')"></div>'
pushresources = [{"file":imgurl,"type":"image"}] if imgurl.startswith("/") else []
replace = {
"KEY_TOPARTIST_IMAGEDIV":imgdiv,
"KEY_ARTISTCHART":topartists,
"KEY_ARTISTLIST":html_charts,
"KEY_RANGE":limitstring,
"KEY_FILTERSELECTOR":html_filterselector}
"KEY_TOPARTIST_IMAGEDIV":imgdiv,
"KEY_ARTISTCHART":html_tiles,
"KEY_ARTISTLIST":html_charts,
"KEY_RANGE":limitstring,
"KEY_FILTERSELECTOR":html_filterselector
}
return (replace,pushresources)

View File

@ -25,20 +25,23 @@ def instructions(keys):
html_tiles = ""
if filterkeys.get("artist") is not None:
imgurl = getArtistImage(filterkeys.get("artist"))
limitstring = "by " + artistLink(filterkeys.get("artist"))
toptracks = ""
imgdiv = '<div style="background-image:url('+imgurl+')"></div>'
elif rep is not None:
imgurl = getTrackImage(rep["artists"],rep["title"])
if get_settings("CHARTS_DISPLAY_TILES"):
toptracks = module_trackcharts_tiles(timerange=timekeys["timerange"])
imgdiv = """<div style="background-image:url('favicon.png')"></div>"""
else:
imgurl = ""
html_tiles = ""
if get_settings("CHARTS_DISPLAY_TILES"):
html_tiles = module_trackcharts_tiles(timerange=timekeys["timerange"])
imgurl = "favicon.png"
imgdiv = '<div style="background-image:url('+imgurl+')"></div>'
limitstring += " " + timekeys["timerange"].desc(prefix=True)
@ -49,7 +52,7 @@ def instructions(keys):
replace = {
"KEY_TOPARTIST_IMAGEDIV":imgdiv,
"KEY_TRACKCHART":toptracks,
"KEY_TRACKCHART":html_tiles,
"KEY_TRACKLIST":html_charts,
"KEY_LIMITS":limitstring,
"KEY_FILTERSELECTOR":html_filterselector,