From 864e7bc46d0998ed936c594cfccfa6b6d5ff70ba Mon Sep 17 00:00:00 2001 From: Zack Boehm Date: Wed, 4 Sep 2019 01:58:28 -0400 Subject: [PATCH] Optionally display tiles in artist + track chart pages This allows for viewing top tiles for any specific timerange --- settings/default.ini | 3 +++ website/charts_artists.html | 5 ++++- website/charts_artists.py | 14 ++++++++++++-- website/charts_tracks.html | 5 ++++- website/charts_tracks.py | 14 ++++++++++++-- website/css/maloja.css | 14 ++++++-------- 6 files changed, 41 insertions(+), 14 deletions(-) diff --git a/settings/default.ini b/settings/default.ini index b795299..df97151 100644 --- a/settings/default.ini +++ b/settings/default.ini @@ -41,6 +41,9 @@ DEFAULT_RANGE_CHARTS_TRACKS = year # can be day, week, month, year DEFAULT_STEP_PULSE = month +# display top tiles on artist and chart pages +CHARTS_DISPLAY_TILES = false + [Fluff] # how many scrobbles a track needs to aquire this status diff --git a/website/charts_artists.html b/website/charts_artists.html index 15a6596..6b070c9 100644 --- a/website/charts_artists.html +++ b/website/charts_artists.html @@ -11,7 +11,7 @@
-
+ KEY_TOPARTIST_IMAGEDIV

Artist Charts

View #1 Artists
@@ -24,6 +24,9 @@
+ + KEY_ARTISTCHART + KEY_ARTISTLIST diff --git a/website/charts_artists.py b/website/charts_artists.py index 1d1c128..e73adf9 100644 --- a/website/charts_artists.py +++ b/website/charts_artists.py @@ -4,8 +4,9 @@ import urllib def instructions(keys): from utilities import getArtistImage from urihandler import compose_querystring, uri_to_internal - from htmlmodules import module_artistcharts, module_filterselection + from htmlmodules import module_artistcharts, module_filterselection, module_artistcharts_tiles from malojatime import range_desc + from doreah.settings import get_settings _, timekeys, _, amountkeys = uri_to_internal(keys) @@ -14,6 +15,9 @@ def instructions(keys): html_filterselector = module_filterselection(keys) + topartists = "" + if get_settings("CHARTS_DISPLAY_TILES"): + topartists = module_artistcharts_tiles(timerange=timekeys["timerange"]) html_charts, rep = module_artistcharts(**amountkeys,**timekeys) @@ -23,10 +27,16 @@ def instructions(keys): else: imgurl = "" + imgdiv = '
' + if get_settings("CHARTS_DISPLAY_TILES"): + imgdiv = "" + pushresources = [{"file":imgurl,"type":"image"}] if imgurl.startswith("/") else [] - replace = {"KEY_TOPARTIST_IMAGEURL":imgurl, + replace = { + "KEY_TOPARTIST_IMAGEDIV":imgdiv, + "KEY_ARTISTCHART":topartists, "KEY_ARTISTLIST":html_charts, "KEY_RANGE":limitstring, "KEY_FILTERSELECTOR":html_filterselector} diff --git a/website/charts_tracks.html b/website/charts_tracks.html index b7c4e3e..769a599 100644 --- a/website/charts_tracks.html +++ b/website/charts_tracks.html @@ -10,7 +10,7 @@
-
+ KEY_TOPARTIST_IMAGEDIV

Track Charts

TOP_TRACKS_LINK
@@ -22,6 +22,9 @@
+ + KEY_TRACKCHART + KEY_TRACKLIST diff --git a/website/charts_tracks.py b/website/charts_tracks.py index db3e7d4..b576f27 100644 --- a/website/charts_tracks.py +++ b/website/charts_tracks.py @@ -5,8 +5,9 @@ def instructions(keys): from utilities import getArtistImage, getTrackImage from htmlgenerators import artistLink from urihandler import compose_querystring, uri_to_internal - from htmlmodules import module_trackcharts, module_filterselection + from htmlmodules import module_trackcharts, module_filterselection, module_trackcharts_tiles from malojatime import range_desc + from doreah.settings import get_settings filterkeys, timekeys, _, amountkeys = uri_to_internal(keys) @@ -22,6 +23,10 @@ def instructions(keys): html_charts, rep = module_trackcharts(**amountkeys,**timekeys,**filterkeys) + toptracks = "" + if get_settings("CHARTS_DISPLAY_TILES"): + toptracks = module_trackcharts_tiles(timerange=timekeys["timerange"]) + if filterkeys.get("artist") is not None: imgurl = getArtistImage(filterkeys.get("artist")) @@ -31,6 +36,10 @@ def instructions(keys): else: imgurl = "" + imgdiv = '
' + if get_settings("CHARTS_DISPLAY_TILES"): + imgdiv = "" + limitstring += " " + timekeys["timerange"].desc(prefix=True) pushresources = [{"file":imgurl,"type":"image"}] if imgurl.startswith("/") else [] @@ -38,7 +47,8 @@ def instructions(keys): replace = { - "KEY_TOPARTIST_IMAGEURL":imgurl, + "KEY_TOPARTIST_IMAGEDIV":imgdiv, + "KEY_TRACKCHART":toptracks, "KEY_TRACKLIST":html_charts, "KEY_LIMITS":limitstring, "KEY_FILTERSELECTOR":html_filterselector, diff --git a/website/css/maloja.css b/website/css/maloja.css index 179d370..0e0777b 100644 --- a/website/css/maloja.css +++ b/website/css/maloja.css @@ -226,13 +226,9 @@ div.searchresults table.searchresults_tracks td span:nth-child(1) { ** */ -table.top_info td.image { - padding:20px; - padding-left:0px; - padding-top:0px; -} - table.top_info td.image div { + margin-right:20px; + margin-bottom:20px; background-size:cover; background-position:center; height:174px; @@ -241,7 +237,6 @@ table.top_info td.image div { table.top_info td.text { vertical-align: top; - padding-left: 30px; } table.top_info td.text h1 { @@ -257,7 +252,10 @@ p.desc a { background-image:url("https://www.last.fm/static/images/lastfm_avatar_twitter.66cd2c48ce03.png"); } - +table.top_info + .stat_module_topartists table, +table.top_info + .stat_module_toptracks table { + margin:15px 0; +} /* **