From 59e38e24eea9e7e1d35445fdf7f01f29c51a0dd4 Mon Sep 17 00:00:00 2001 From: Krateng Date: Sat, 21 Sep 2019 20:51:49 +0200 Subject: [PATCH] Reorganized charts code --- website/charts_artists.py | 19 ++++++++++--------- website/charts_tracks.py | 15 +++++++++------ 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/website/charts_artists.py b/website/charts_artists.py index 3f4df66..b5c951c 100644 --- a/website/charts_artists.py +++ b/website/charts_artists.py @@ -25,22 +25,23 @@ def instructions(keys): else: imgurl = "" - topartists = "" - imgdiv = '
' + html_tiles = "" if get_settings("CHARTS_DISPLAY_TILES"): - topartists = module_artistcharts_tiles(timerange=timekeys["timerange"]) - imgdiv = """
""" + html_tiles = module_artistcharts_tiles(timerange=timekeys["timerange"]) + imgurl = "favicon.png" + imgdiv = '
' 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) diff --git a/website/charts_tracks.py b/website/charts_tracks.py index fe96ba2..843d0ff 100644 --- a/website/charts_tracks.py +++ b/website/charts_tracks.py @@ -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 = '
' 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 = """
""" else: imgurl = "" + html_tiles = "" + if get_settings("CHARTS_DISPLAY_TILES"): + html_tiles = module_trackcharts_tiles(timerange=timekeys["timerange"]) + imgurl = "favicon.png" + + imgdiv = '
' + 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,