diff --git a/maloja/web/jinja/artist.jinja b/maloja/web/jinja/artist.jinja index a1c8701..d29b8a6 100644 --- a/maloja/web/jinja/artist.jinja +++ b/maloja/web/jinja/artist.jinja @@ -70,9 +70,8 @@ -

Top Tracks

+

Top Tracks

-{# htmlmodules.module_trackcharts(**filterkeys,max_=15)[0] #} {% import 'partials/charts_tracks.jinja' as charts_tracks %} {{ charts_tracks.charts_tracks(filterkeys,limitkeys,{"perpage":15,"page":0},compare=false) }} @@ -83,62 +82,63 @@ -

Pulse

+

Pulse


- {% for range in xranges %} + {% for r in xranges %} - {{ range.localisation }} + onclick="showRangeManual('pulse','{{ r.identifier }}')" + class="stat_selector_pulse selector_pulse_{{ r.identifier }}" + style="{{ 'opacity:0.5;' if initialrange==r.identifier else '' }}"> + {{ r.localisation }} {% if not loop.last %}|{% endif %} {% endfor %}

- {% import 'partials/pulse.jinja' as pulse %} - {% for range in xranges %} + {% for r in xranges %} - {{ pulse.pulse(filterkeys,{'since':range.firstrange},{'step':range.identifier,'trail':1},amountkeys) }} + {% with limitkeys={"since":r.firstrange},delimitkeys={'step':r.identifier,'trail':1} %} + {% include 'partials/pulse.jinja' %} + {% endwith %} {% endfor %} -

Performance

+

Performance

{% if not competes %}of {{ htmlgenerators.artistLink(credited) }} {% endif %}
- {% for range in xranges %} + {% for r in xranges %} - {{ range.localisation }} + onclick="showRangeManual('pulse','{{ r.identifier }}')" + class="stat_selector_pulse selector_pulse_{{ r.identifier }}" + style="{{ 'opacity:0.5;' if initialrange==r.identifier else '' }}"> + {{ r.localisation }} {% if not loop.last %}|{% endif %} {% endfor %}

- {% import 'partials/performance.jinja' as performance %} - {% for range in xranges %} + {% for r in xranges %} - {{ performance.performance({'artist':credited},{'since':range.firstrange},{'step':range.identifier,'trail':1},amountkeys) }} - + {% with limitkeys={"since":r.firstrange},delimitkeys={'step':r.identifier,'trail':1} %} + {% include 'partials/performance.jinja' %} + {% endwith %} {% endfor %} @@ -148,10 +148,10 @@ -

Last Scrobbles

- -{% import 'partials/scrobbles.jinja' as scrobbles %} -{{ scrobbles.scrobbles(filterkeys,limitkeys,{"perpage":15,"page":0}) }} +

Last Scrobbles

+{% with amountkeys = {"perpage":15,"page":0} %} +{% include 'partials/scrobbles.jinja' %} +{% endwith %} {% endblock %} diff --git a/maloja/web/jinja/charts_artists.jinja b/maloja/web/jinja/charts_artists.jinja index b7969c2..6bd89a3 100644 --- a/maloja/web/jinja/charts_artists.jinja +++ b/maloja/web/jinja/charts_artists.jinja @@ -27,7 +27,8 @@

Artist Charts

View #1 Artists
{{ limitkeys.timerange.desc(prefix=True) }}

- {{ htmlmodules.module_filterselection(_urikeys) }} + {% import 'snippets/timeselection.jinja' as timeselection %} + {{ timeselection.selector(filterkeys,limitkeys,delimitkeys) }} diff --git a/maloja/web/jinja/charts_tracks.jinja b/maloja/web/jinja/charts_tracks.jinja index e116774..37729f6 100644 --- a/maloja/web/jinja/charts_tracks.jinja +++ b/maloja/web/jinja/charts_tracks.jinja @@ -27,7 +27,8 @@ {% if filterkeys.get('artist') is not none %}by {{ htmlgenerators.artistLink(filterkeys.get('artist')) }}{% endif %} {{ limitkeys.timerange.desc(prefix=True) }}

- {{ htmlmodules.module_filterselection(_urikeys) }} + {% import 'snippets/timeselection.jinja' as timeselection %} + {{ timeselection.selector(filterkeys,limitkeys,delimitkeys) }} diff --git a/maloja/web/jinja/partials/performance.jinja b/maloja/web/jinja/partials/performance.jinja index e87ff69..5033907 100644 --- a/maloja/web/jinja/partials/performance.jinja +++ b/maloja/web/jinja/partials/performance.jinja @@ -1,5 +1,3 @@ -{% macro performance(filterkeys,limitkeys,delimitkeys,amountkeys) %} - {% set ranges = dbp.get_performance(filterkeys,limitkeys,delimitkeys) %} {% set minrank = ranges|map(attribute="rank")|reject("none")|max|default(60) %} @@ -25,6 +23,3 @@ {% endfor %} - - -{%- endmacro %} diff --git a/maloja/web/jinja/partials/pulse.jinja b/maloja/web/jinja/partials/pulse.jinja index 5fd76eb..cc59c05 100644 --- a/maloja/web/jinja/partials/pulse.jinja +++ b/maloja/web/jinja/partials/pulse.jinja @@ -1,5 +1,3 @@ -{% macro pulse(filterkeys,limitkeys,delimitkeys,amountkeys) %} - {% set ranges = dbp.get_pulse(filterkeys,limitkeys,delimitkeys) %} {% set maxbar = ranges|map(attribute="scrobbles")|max|default(1) %} @@ -20,6 +18,3 @@ {% endfor %} - - -{%- endmacro %} diff --git a/maloja/web/jinja/partials/scrobbles.jinja b/maloja/web/jinja/partials/scrobbles.jinja index 26ccdd6..b4c8de9 100644 --- a/maloja/web/jinja/partials/scrobbles.jinja +++ b/maloja/web/jinja/partials/scrobbles.jinja @@ -1,5 +1,3 @@ -{% macro scrobbles(filterkeys,limitkeys,amountkeys,shortTimeDesc=False) %} - {% set scrobbles = dbp.get_scrobbles(filterkeys,limitkeys,amountkeys) %} {% set firstindex = amountkeys.page * amountkeys.perpage %} @@ -18,5 +16,3 @@ {% endif %} {% endfor %} - -{%- endmacro %} diff --git a/maloja/web/jinja/partials/top_artists.jinja b/maloja/web/jinja/partials/top_artists.jinja index 1beb559..cd457da 100644 --- a/maloja/web/jinja/partials/top_artists.jinja +++ b/maloja/web/jinja/partials/top_artists.jinja @@ -1,5 +1,3 @@ -{% macro top_artists(limitkeys,delimitkeys,amountkeys) %} - {% set ranges = dbp.get_top_artists(limitkeys,delimitkeys) %} {% set maxbar = ranges|map(attribute="scrobbles")|max|default(1) %} @@ -27,6 +25,3 @@ {% endfor %} - - -{%- endmacro %} diff --git a/maloja/web/jinja/partials/top_tracks.jinja b/maloja/web/jinja/partials/top_tracks.jinja index 7be622c..7dd7275 100644 --- a/maloja/web/jinja/partials/top_tracks.jinja +++ b/maloja/web/jinja/partials/top_tracks.jinja @@ -1,5 +1,3 @@ -{% macro top_tracks(filterkeys,limitkeys,delimitkeys,amountkeys) %} - {% set ranges = dbp.get_top_tracks(filterkeys,limitkeys,delimitkeys) %} {% set maxbar = ranges|map(attribute="scrobbles")|max|default(1) %} @@ -27,6 +25,3 @@ {% endfor %} - - -{%- endmacro %} diff --git a/maloja/web/jinja/performance.jinja b/maloja/web/jinja/performance.jinja index 3fd7262..c5e4321 100644 --- a/maloja/web/jinja/performance.jinja +++ b/maloja/web/jinja/performance.jinja @@ -2,7 +2,6 @@ {% block title %}Maloja - {{ malojatime.delimit_desc_p(delimitkeys) }} Performance{% endblock %} {% import 'snippets/filterdescription.jinja' as filterdesc %} -{% import 'partials/performance.jinja' as performance %} {% if filterkeys.get('track') is not none %} {% set img = utilities.getTrackImage(artists=filterkeys.track.artists,title=filterkeys.track.title,fast=True) %} @@ -21,18 +20,19 @@

{{ malojatime.delimit_desc_p(delimitkeys) }} Performance

{% if limitkeys != {} %} - View Pulse + View Pulse {% endif %}
{{ filterdesc.desc(filterkeys,limitkeys,prefix='of') }}

- {{ htmlmodules.module_filterselection(_urikeys,delimit=True) }} + {% import 'snippets/timeselection.jinja' as timeselection %} + {{ timeselection.selector(filterkeys,limitkeys,delimitkeys,delimit=True) }} - {{ performance.performance(filterkeys,limitkeys,delimitkeys,amountkeys) }} + {% include 'partials/performance.jinja' %} {% endblock %} diff --git a/maloja/web/jinja/pulse.jinja b/maloja/web/jinja/pulse.jinja index 775788e..dd3f1f3 100644 --- a/maloja/web/jinja/pulse.jinja +++ b/maloja/web/jinja/pulse.jinja @@ -2,7 +2,6 @@ {% block title %}Maloja - {{ malojatime.delimit_desc_p(delimitkeys) }} Pulse{% endblock %} {% import 'snippets/filterdescription.jinja' as filterdesc %} -{% import 'partials/pulse.jinja' as pulse %} {% if filterkeys.get('track') is not none %} {% set img = utilities.getTrackImage(artists=filterkeys.track.artists,title=filterkeys.track.title,fast=True) %} @@ -21,18 +20,19 @@

{{ malojatime.delimit_desc_p(delimitkeys) }} Pulse

{% if filterkeys != {} %} - View Rankings + View Rankings {% endif %}
{{ filterdesc.desc(filterkeys,limitkeys,prefix='of') }}

- {{ htmlmodules.module_filterselection(_urikeys,delimit=True) }} + {% import 'snippets/timeselection.jinja' as timeselection %} + {{ timeselection.selector(filterkeys,limitkeys,delimitkeys,delimit=True) }} - {{ pulse.pulse(filterkeys,limitkeys,delimitkeys,amountkeys) }} + {% include 'partials/pulse.jinja' %} {% endblock %} diff --git a/maloja/web/jinja/scrobbles.jinja b/maloja/web/jinja/scrobbles.jinja index 078f7b6..16fe9f7 100644 --- a/maloja/web/jinja/scrobbles.jinja +++ b/maloja/web/jinja/scrobbles.jinja @@ -2,7 +2,6 @@ {% block title %}Maloja - Scrobbles{% endblock %} {% import 'snippets/filterdescription.jinja' as filterdesc %} -{% import 'partials/scrobbles.jinja' as scrobblemodule %} {% import 'snippets/pagination.jinja' as pagination %} {% set scrobbles = dbp.get_scrobbles(filterkeys,limitkeys,amountkeys) %} @@ -32,14 +31,15 @@

{{ scrobbles.__len__() }} Scrobbles


- {{ htmlmodules.module_filterselection(_urikeys) }} + {% import 'snippets/timeselection.jinja' as timeselection %} + {{ timeselection.selector(filterkeys,limitkeys,delimitkeys) }} - {{ scrobblemodule.scrobbles(filterkeys,limitkeys,amountkeys) }} + {% include 'partials/scrobbles.jinja' %} {{ pagination.pagination(filterkeys,limitkeys,delimitkeys,amountkeys,pages) }} diff --git a/maloja/web/jinja/snippets/timeselection.jinja b/maloja/web/jinja/snippets/timeselection.jinja new file mode 100644 index 0000000..03a2b9c --- /dev/null +++ b/maloja/web/jinja/snippets/timeselection.jinja @@ -0,0 +1,64 @@ +{% macro selector(filterkeys,limitkeys,delimitkeys,amountkeys,limit=True,delimit=False) %} + + + {% if not limit %}{% set limitkeys = {} %}{% endif %} + {% if not delimit %}{% set delimitkeys = {} %}{% endif %} + + {% set allkeys = [filterkeys,limitkeys,delimitkeys,amountkeys] | combine_dicts %} + + + {% if limit %} + +
+ {% set thisrange = limitkeys.timerange %} + {% set prevrange = thisrange.next(-1) %} + {% set nextrange = thisrange.next(1) %} + + {% if prevrange is not none %} + {{ prevrange.desc() }} + « + {% endif %} + {% if prevrange is not none or nextrange is not none %} + {{ thisrange.desc() }} + {% endif %} + {% if nextrange is not none %} + » + {{ nextrange.desc() }} + {% endif %} + +
+ + +
+ {% for r in xcurrent %} + {% if r.range == limitkeys.timerange %} + {{ r.localisation }} + {% else %} + {{ r.localisation }} + {% endif %} + {{ "|" if not loop.last }} + {% endfor %} +
+ {% endif %} + + + {% if delimit %} +
+ {% for cat in [xdelimiters,xtrails] %} + {% for r in cat %} + {# {% if all(r.keys[k] == allkeys[k] for k in r.keys) %} #} + {% if r.replacekeys | map('compare_key_in_dicts',r.replacekeys,allkeys) | alltrue %} + {{ r.localisation }} + {% else %} + {{ r.localisation }} + {% endif %} + {{ "|" if not loop.last }} + {% endfor %} +
+ {% endfor %} +
+ + {% endif %} + + +{% endmacro %} diff --git a/maloja/web/jinja/start.jinja b/maloja/web/jinja/start.jinja index ee4beb3..eec3576 100644 --- a/maloja/web/jinja/start.jinja +++ b/maloja/web/jinja/start.jinja @@ -61,7 +61,6 @@
- {% import 'partials/scrobbles.jinja' as scr %}

Last Scrobbles

@@ -74,7 +73,9 @@ - {{ scr.scrobbles({},{},{"perpage":15,"page":0},shortTimeDesc=True) }} + {% with amountkeys = {"perpage":15,"page":0}, shortTimeDesc=True %} + {% include 'partials/scrobbles.jinja' %} + {% endwith %} @@ -84,7 +85,6 @@ - {% import 'partials/pulse.jinja' as pls %}

Pulse

{% for range in xranges %} @@ -95,7 +95,9 @@ {% for range in xranges %} {% endfor %} diff --git a/maloja/web/jinja/top_artists.jinja b/maloja/web/jinja/top_artists.jinja index ac08b65..a00512d 100644 --- a/maloja/web/jinja/top_artists.jinja +++ b/maloja/web/jinja/top_artists.jinja @@ -20,13 +20,13 @@ {{ limitkeys.timerange.desc(prefix=True) }}

- {{ htmlmodules.module_filterselection(_urikeys,delimit=True) }} + {% import 'snippets/timeselection.jinja' as timeselection %} + {{ timeselection.selector(filterkeys,limitkeys,delimitkeys,delimit=True) }} - {% import 'partials/top_artists.jinja' as top_artists %} - {{ top_artists.top_artists(limitkeys,delimitkeys,amountkeys) }} + {% include 'partials/top_artists.jinja' %} {% endblock %} diff --git a/maloja/web/jinja/top_tracks.jinja b/maloja/web/jinja/top_tracks.jinja index e35ee95..961adb8 100644 --- a/maloja/web/jinja/top_tracks.jinja +++ b/maloja/web/jinja/top_tracks.jinja @@ -20,13 +20,12 @@ {{ limitkeys.timerange.desc(prefix=True) }}

- {{ htmlmodules.module_filterselection(_urikeys,delimit=True) }} + {% import 'snippets/timeselection.jinja' as timeselection %} + {{ timeselection.selector(filterkeys,limitkeys,delimitkeys,delimit=True) }} - - {% import 'partials/top_tracks.jinja' as top_tracks %} - {{ top_tracks.top_tracks(filterkeys,limitkeys,delimitkeys,amountkeys) }} + {% include 'partials/top_tracks.jinja' %} {% endblock %} diff --git a/maloja/web/jinja/track.jinja b/maloja/web/jinja/track.jinja index d8edd89..e3c7099 100644 --- a/maloja/web/jinja/track.jinja +++ b/maloja/web/jinja/track.jinja @@ -47,7 +47,7 @@

{% if adminmode %}Scrobble now{% endif %} - {{ info['scrobbles'] }} Scrobbles + {{ info['scrobbles'] }} Scrobbles

@@ -67,59 +67,60 @@ -

Pulse

+

Pulse


- {% for range in xranges %} + {% for r in xranges %} - {{ range.localisation }} + onclick="showRangeManual('pulse','{{ r.identifier }}')" + class="stat_selector_pulse selector_pulse_{{ r.identifier }}" + style="{{ 'opacity:0.5;' if initialrange==r.identifier else '' }}"> + {{ r.localisation }} {% if not loop.last %}|{% endif %} {% endfor %}

- {% import 'partials/pulse.jinja' as pulse %} - {% for range in xranges %} + {% for r in xranges %} - {{ pulse.pulse(filterkeys,{'since':range.firstrange},{'step':range.identifier,'trail':1},amountkeys) }} + {% with limitkeys={"since":r.firstrange},delimitkeys={'step':r.identifier,'trail':1} %} + {% include 'partials/pulse.jinja' %} + {% endwith %} {% endfor %} -

Performance

+

Performance


- {% for range in xranges %} + {% for r in xranges %} - {{ range.localisation }} + onclick="showRangeManual('pulse','{{ r.identifier }}')" + class="stat_selector_pulse selector_pulse_{{ r.identifier }}" + style="{{ 'opacity:0.5;' if initialrange==r.identifier else '' }}"> + {{ r.localisation }} {% if not loop.last %}|{% endif %} {% endfor %}

- {% import 'partials/performance.jinja' as performance %} - {% for range in xranges %} + {% for r in xranges %} - {{ performance.performance(filterkeys,{'since':range.firstrange},{'step':range.identifier,'trail':1},amountkeys) }} - + {% with limitkeys={"since":r.firstrange},delimitkeys={'step':r.identifier,'trail':1} %} + {% include 'partials/performance.jinja' %} + {% endwith %} {% endfor %} @@ -129,10 +130,11 @@ -

Last Scrobbles

+

Last Scrobbles

-{% import 'partials/scrobbles.jinja' as scrobbles %} -{{ scrobbles.scrobbles(filterkeys,limitkeys,{"perpage":15,"page":0}) }} +{% with amountkeys = {"perpage":15,"page":0} %} +{% include 'partials/scrobbles.jinja' %} +{% endwith %} {% endblock %}