From 0439484f78fc3bf58426ad0d235610f9ae778e91 Mon Sep 17 00:00:00 2001 From: Krateng Date: Tue, 9 Apr 2019 11:48:12 +0200 Subject: [PATCH] Can now set default range for startpage tiles in settings --- settings/default.ini | 7 +++++++ website/start.html | 2 ++ website/start.py | 5 +++++ 3 files changed, 14 insertions(+) diff --git a/settings/default.ini b/settings/default.ini index bd9da59..d8c8661 100644 --- a/settings/default.ini +++ b/settings/default.ini @@ -16,3 +16,10 @@ CACHE_EXPIRE_POSITIVE = 300 # after how many days positive results should be ref USE_LOCAL_IMAGES = true LOCAL_IMAGE_ROTATE = 3600 # when multiple images are present locally, how many seconds we wait between rotation + +[Web Interface] + +# what range is shown per default for the tile view on the start page +# can be week, month, year, alltime +DEFAULT_RANGE_CHARTS_ARTISTS = year +DEFAULT_RANGE_CHARTS_TRACKS = year diff --git a/website/start.html b/website/start.html index ace69b0..fab8e90 100644 --- a/website/start.html +++ b/website/start.html @@ -21,6 +21,8 @@ } document.getElementById("selector_" + identifier + "_" + unit).setAttribute("style","opacity:0.5;") } + + document.addEventListener('DOMContentLoaded',function() {KEY_JS_INIT_TILES}) diff --git a/website/start.py b/website/start.py index d7c4fde..c979f64 100644 --- a/website/start.py +++ b/website/start.py @@ -2,6 +2,7 @@ import urllib from datetime import datetime, timedelta import database from doreah.timing import clock, clockp +from doreah.settings import get_settings from htmlmodules import module_scrobblelist, module_pulse, module_artistcharts_tiles, module_trackcharts_tiles @@ -36,6 +37,9 @@ 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 html_scrobbles, _, _ = module_scrobblelist(max_=15,shortTimeDesc=True,pictures=True,earlystop=True) @@ -95,6 +99,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_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,