1
0
mirror of https://github.com/krateng/maloja.git synced 2023-08-10 21:12:55 +03:00

Replaced settings calls in jinja files

This commit is contained in:
krateng 2021-12-19 22:25:01 +01:00
parent 6ccbf68923
commit df22a595b8
8 changed files with 12 additions and 12 deletions

View File

@ -1,8 +1,8 @@
from .. import database_packed from .. import database_packed
from . import filters from . import filters
from .globalconf import malojaconfig
from .. import database, database_packed, malojatime, utilities, malojauri from .. import database, database_packed, malojatime, utilities, malojauri
from doreah import settings
from doreah.regular import repeatdaily from doreah.regular import repeatdaily
import urllib import urllib
@ -30,7 +30,7 @@ def update_jinja_environment():
"malojatime": malojatime, "malojatime": malojatime,
"utilities": utilities, "utilities": utilities,
"mlj_uri": malojauri, "mlj_uri": malojauri,
"settings": settings.get_settings, "settings": malojaconfig,
# external # external
"urllib": urllib, "urllib": urllib,
"math":math, "math":math,

View File

@ -48,7 +48,7 @@
<span>Get your own Maloja scrobble server on <a target="_blank" rel="noopener noreferrer" href="https://pypi.org/project/malojaserver/">PyPI</a></span> <span>Get your own Maloja scrobble server on <a target="_blank" rel="noopener noreferrer" href="https://pypi.org/project/malojaserver/">PyPI</a></span>
</div> </div>
<div> <div>
<a href="/"><span style="font-weight:bold;">Maloja {% if settings("DEV_MODE") %}[Developer Mode]{% endif %}</span></a> <a href="/"><span style="font-weight:bold;">Maloja {% if settings["DEV_MODE"] %}[Developer Mode]{% endif %}</span></a>
</div> </div>
<div> <div>
<span><input id="searchinput" placeholder="Search for an artist or track..." oninput="search(this)" onblur="clearresults()" /></span> <span><input id="searchinput" placeholder="Search for an artist or track..." oninput="search(this)" onblur="clearresults()" /></span>

View File

@ -35,7 +35,7 @@
</tr> </tr>
</table> </table>
{% if settings('CHARTS_DISPLAY_TILES') %} {% if settings['CHARTS_DISPLAY_TILES'] %}
{% include 'partials/charts_artists_tiles.jinja' %} {% include 'partials/charts_artists_tiles.jinja' %}
<br/><br/> <br/><br/>
{% endif %} {% endif %}

View File

@ -37,7 +37,7 @@
</tr> </tr>
</table> </table>
{% if settings('CHARTS_DISPLAY_TILES') %} {% if settings['CHARTS_DISPLAY_TILES'] %}
{% include 'partials/charts_tracks_tiles.jinja' %} {% include 'partials/charts_tracks_tiles.jinja' %}
<br/><br/> <br/><br/>
{% endif %} {% endif %}

View File

@ -10,7 +10,7 @@
<td class='icon'><div style="background-image:url('{{ img }}')"></div></td> <td class='icon'><div style="background-image:url('{{ img }}')"></div></td>
{% if "artists" in entity %} {% if "artists" in entity %}
{% if settings('TRACK_SEARCH_PROVIDER') is not none %} {% if settings['TRACK_SEARCH_PROVIDER'] %}
<td class='searchProvider'>{{ links.link_search(entity) }}</td> <td class='searchProvider'>{{ links.link_search(entity) }}</td>
{% endif %} {% endif %}
<td class='track'> <td class='track'>

View File

@ -62,7 +62,7 @@
{% macro link_search(entity) -%} {% macro link_search(entity) -%}
{% set searchstr = (entity.artists + [entity.title]) | join(" ") | urlencode %} {% set searchstr = (entity.artists + [entity.title]) | join(" ") | urlencode %}
{% set searchprovider = settings('TRACK_SEARCH_PROVIDER') | lower | replace(' ','') %} {% set searchprovider = settings['TRACK_SEARCH_PROVIDER'] | lower | replace(' ','') %}
{% set searchproviders = {% set searchproviders =
{ {
"youtube":'https://www.youtube.com/results?search_query=', "youtube":'https://www.youtube.com/results?search_query=',

View File

@ -31,7 +31,7 @@
{% for r in xcurrent %} {% for r in xcurrent %}
{% if r.range == limitkeys.timerange %} {% if r.range == limitkeys.timerange %}
<span class='stat_selector' style='opacity:0.5;'>{{ r.localisation }}</span> <span class='stat_selector' style='opacity:0.5;'>{{ r.localisation }}</span>
{% elif r.heavy and settings('DISCOURAGE_CPU_HEAVY_STATS') %} {% 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> <span class='stat_selector blocked' title="CPU heavy statistics are discouraged at the moment.">{{ r.localisation }}</span>
{% else %} {% else %}
<a href='{{ mlj_uri.create_uri("",allkeys,{"timerange":r.range}) }}'><span class='stat_selector'>{{ r.localisation }}</span></a> <a href='{{ mlj_uri.create_uri("",allkeys,{"timerange":r.range}) }}'><span class='stat_selector'>{{ r.localisation }}</span></a>
@ -49,7 +49,7 @@
{# {% if all(r.keys[k] == allkeys[k] for k in r.keys) %} #} {# {% if all(r.keys[k] == allkeys[k] for k in r.keys) %} #}
{% if r.replacekeys | map('compare_key_in_dicts',r.replacekeys,allkeys) | alltrue %} {% if r.replacekeys | map('compare_key_in_dicts',r.replacekeys,allkeys) | alltrue %}
<span class='stat_selector' style='opacity:0.5;'>{{ r.localisation }}</span> <span class='stat_selector' style='opacity:0.5;'>{{ r.localisation }}</span>
{% elif r.heavy and settings('DISCOURAGE_CPU_HEAVY_STATS') %} {% 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> <span class='stat_selector blocked' title="CPU heavy statistics are discouraged at the moment.">{{ r.localisation }}</span>
{% else %} {% else %}
<a href='{{ mlj_uri.create_uri("",allkeys,r.replacekeys) }}'><span class='stat_selector'>{{ r.localisation }}</span></a> <a href='{{ mlj_uri.create_uri("",allkeys,r.replacekeys) }}'><span class='stat_selector'>{{ r.localisation }}</span></a>

View File

@ -4,9 +4,9 @@
{% block scripts %} {% block scripts %}
<script>document.addEventListener('DOMContentLoaded',function() { <script>document.addEventListener('DOMContentLoaded',function() {
showRange('topartists','{{ settings("DEFAULT_RANGE_CHARTS_ARTISTS") }}'); showRange('topartists','{{ settings["DEFAULT_RANGE_CHARTS_ARTISTS"] }}');
showRange('toptracks','{{ settings("DEFAULT_RANGE_CHARTS_TRACKS") }}'); showRange('toptracks','{{ settings["DEFAULT_RANGE_CHARTS_TRACKS"] }}');
showRange('pulse','{{ settings("DEFAULT_STEP_PULSE") }}'); showRange('pulse','{{ settings["DEFAULT_STEP_PULSE"] }}');
})</script> })</script>
<script src="/rangeselect.js"></script> <script src="/rangeselect.js"></script>
<script src="/cookies.js"></script> <script src="/cookies.js"></script>