mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Added ability to discourage CPU-heavy statistics
This commit is contained in:
parent
cbd93d2b33
commit
90d6e67e97
@ -67,6 +67,10 @@ DEFAULT_STEP_PULSE = month
|
||||
# display top tiles on artist and track chart pages
|
||||
CHARTS_DISPLAY_TILES = false
|
||||
|
||||
# this does not actually block any requests, it's just an interface feature t
|
||||
# prevent visitors from mindlessly clicking on those options and hogging your cpu
|
||||
DISCOURAGE_CPU_HEAVY_STATS = false
|
||||
|
||||
[Fluff]
|
||||
|
||||
# how many scrobbles a track needs to aquire this status
|
||||
|
@ -55,7 +55,7 @@ def update_jinja_environment():
|
||||
{"identifier":"alltime","localisation":"All Time","range":malojatime.alltime()}
|
||||
],
|
||||
"xdelimiters": [
|
||||
{"identifier":"daily","replacekeys":{"step":"day","stepn":1},"localisation":"Daily"},
|
||||
{"identifier":"daily","replacekeys":{"step":"day","stepn":1},"localisation":"Daily","heavy":True},
|
||||
{"identifier":"weekly","replacekeys":{"step":"week","stepn":1},"localisation":"Weekly"},
|
||||
{"identifier":"fortnightly","replacekeys":{"step":"week","stepn":2},"localisation":"Fortnightly"},
|
||||
{"identifier":"monthly","replacekeys":{"step":"month","stepn":1},"localisation":"Monthly"},
|
||||
@ -66,8 +66,8 @@ def update_jinja_environment():
|
||||
{"identifier":"standard","replacekeys":{"trail":1},"localisation":"Standard"},
|
||||
{"identifier":"trailing","replacekeys":{"trail":2},"localisation":"Trailing"},
|
||||
{"identifier":"longtrailing","replacekeys":{"trail":3},"localisation":"Long Trailing"},
|
||||
{"identifier":"inert","replacekeys":{"trail":10},"localisation":"Inert"},
|
||||
{"identifier":"cumulative","replacekeys":{"trail":math.inf},"localisation":"Cumulative"}
|
||||
{"identifier":"inert","replacekeys":{"trail":10},"localisation":"Inert","heavy":True},
|
||||
{"identifier":"cumulative","replacekeys":{"trail":math.inf},"localisation":"Cumulative","heavy":True}
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
{% set allkeys = [filterkeys,limitkeys,delimitkeys,amountkeys] | combine_dicts %}
|
||||
|
||||
|
||||
|
||||
{% if limitkeys != {} %}
|
||||
|
||||
<div>
|
||||
@ -30,6 +31,8 @@
|
||||
{% for r in xcurrent %}
|
||||
{% if r.range == limitkeys.timerange %}
|
||||
<span class='stat_selector' style='opacity:0.5;'>{{ r.localisation }}</span>
|
||||
{% elif r.heavy and settings('DISCOURAGE_CPU_HEAVY_STATS') %}
|
||||
<span class='stat_selector blocked' title="CPU heavy statistics are discouraged at the moment.">{{ r.localisation }}</span>
|
||||
{% else %}
|
||||
<a href='{{ mlj_uri.create_uri("",allkeys,{"timerange":r.range}) }}'><span class='stat_selector'>{{ r.localisation }}</span></a>
|
||||
{% endif %}
|
||||
@ -46,6 +49,8 @@
|
||||
{# {% if all(r.keys[k] == allkeys[k] for k in r.keys) %} #}
|
||||
{% if r.replacekeys | map('compare_key_in_dicts',r.replacekeys,allkeys) | alltrue %}
|
||||
<span class='stat_selector' style='opacity:0.5;'>{{ r.localisation }}</span>
|
||||
{% elif r.heavy and settings('DISCOURAGE_CPU_HEAVY_STATS') %}
|
||||
<span class='stat_selector blocked' title="CPU heavy statistics are discouraged at the moment.">{{ r.localisation }}</span>
|
||||
{% else %}
|
||||
<a href='{{ mlj_uri.create_uri("",allkeys,r.replacekeys) }}'><span class='stat_selector'>{{ r.localisation }}</span></a>
|
||||
{% endif %}
|
||||
|
@ -258,6 +258,11 @@ table.top_info + .stat_module_toptracks table {
|
||||
font-size:80%;
|
||||
}
|
||||
|
||||
.blocked {
|
||||
opacity:0.2;
|
||||
cursor:not-allowed;
|
||||
}
|
||||
|
||||
|
||||
input#apikey {
|
||||
font-family:'Ubuntu';
|
||||
|
Loading…
Reference in New Issue
Block a user