From 7d04ea395350a412c4b0f1fe981d6c44a16f4c33 Mon Sep 17 00:00:00 2001 From: Krateng Date: Tue, 9 Apr 2019 11:56:09 +0200 Subject: [PATCH] Added setting for default pulse as well --- settings/default.ini | 3 +++ website/start.html | 2 +- website/start.py | 10 +++++++--- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/settings/default.ini b/settings/default.ini index d8c8661..cb5d737 100644 --- a/settings/default.ini +++ b/settings/default.ini @@ -23,3 +23,6 @@ LOCAL_IMAGE_ROTATE = 3600 # when multiple images are present locally, how many s # can be week, month, year, alltime DEFAULT_RANGE_CHARTS_ARTISTS = year DEFAULT_RANGE_CHARTS_TRACKS = year +# same for pulse view +# can be days, weeks, months, years +DEFAULT_RANGE_PULSE = months diff --git a/website/start.html b/website/start.html index fab8e90..cbfc880 100644 --- a/website/start.html +++ b/website/start.html @@ -22,7 +22,7 @@ document.getElementById("selector_" + identifier + "_" + unit).setAttribute("style","opacity:0.5;") } - document.addEventListener('DOMContentLoaded',function() {KEY_JS_INIT_TILES}) + document.addEventListener('DOMContentLoaded',function() {KEY_JS_INIT_RANGES}) diff --git a/website/start.py b/website/start.py index c979f64..2f0f0c8 100644 --- a/website/start.py +++ b/website/start.py @@ -9,6 +9,11 @@ from htmlmodules import module_scrobblelist, module_pulse, module_artistcharts_t def instructions(keys): + # commands to execute on load for default ranges + js_command = "showRange('topartists','" + get_settings("DEFAULT_RANGE_CHARTS_ARTISTS") + "');" + js_command += "showRange('toptracks','" + get_settings("DEFAULT_RANGE_CHARTS_TRACKS") + "');" + js_command += "showRange('pulse','" + get_settings("DEFAULT_RANGE_PULSE") + "');" + # get start of week tod = datetime.utcnow() change = (tod.weekday() + 1) % 7 @@ -37,8 +42,7 @@ def instructions(keys): clockp("Tracks") - js_command = "showRange('topartists','" + get_settings("DEFAULT_RANGE_CHARTS_ARTISTS") + "');" - js_command += "showRange('toptracks','" + get_settings("DEFAULT_RANGE_CHARTS_TRACKS") + "');" + # scrobbles @@ -99,7 +103,7 @@ def instructions(keys): # "KEY_PULSE_TERM":pulse_rangedescs,"KEY_PULSE_AMOUNT":pulse_amounts,"KEY_PULSE_BAR":pulse_bars "KEY_TOPARTISTS_TOTAL":topartists_total,"KEY_TOPARTISTS_YEAR":topartists_year,"KEY_TOPARTISTS_MONTH":topartists_month,"KEY_TOPARTISTS_WEEK":topartists_week, "KEY_TOPTRACKS_TOTAL":toptracks_total,"KEY_TOPTRACKS_YEAR":toptracks_year,"KEY_TOPTRACKS_MONTH":toptracks_month,"KEY_TOPTRACKS_WEEK":toptracks_week, - "KEY_JS_INIT_TILES":js_command, + "KEY_JS_INIT_RANGES":js_command, "KEY_SCROBBLE_NUM_TODAY":scrobbles_today,"KEY_SCROBBLE_NUM_MONTH":scrobbles_month,"KEY_SCROBBLE_NUM_YEAR":scrobbles_year,"KEY_SCROBBLE_NUM_TOTAL":scrobbles_total, "KEY_SCROBBLES":html_scrobbles, "KEY_PULSE_MONTHS":html_pulse_months,"KEY_PULSE_YEARS":html_pulse_years,"KEY_PULSE_DAYS":html_pulse_days,"KEY_PULSE_WEEKS":html_pulse_weeks,