diff --git a/maloja/web/jinja/charts_artists.jinja b/maloja/web/jinja/charts_artists.jinja new file mode 100644 index 0000000..4866901 --- /dev/null +++ b/maloja/web/jinja/charts_artists.jinja @@ -0,0 +1,34 @@ +{% extends "base.jinja" %} +{% block title %}Maloja - {{ artist }}{% endblock %} + +{% block scripts %} + +{% endblock %} + +{% set charts = dbp.get_charts_artists(filterkeys,limitkeys) %} + + +{% block content %} + + + + + + +
+
+
+

Artist Charts

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

+ {{ htmlmodules.module_filterselection(_urikeys) }} + +
+ + +{% import 'partials/charts_artists.jinja' as charts_artists %} + +{{ charts_artists.charts_artists(limitkeys,amountkeys,compare=False) }} + + +{% endblock %} diff --git a/maloja/web/jinja/charts_tracks.jinja b/maloja/web/jinja/charts_tracks.jinja new file mode 100644 index 0000000..b25b11e --- /dev/null +++ b/maloja/web/jinja/charts_tracks.jinja @@ -0,0 +1,34 @@ +{% extends "base.jinja" %} +{% block title %}Maloja - Track Charts{% endblock %} + +{% block scripts %} + +{% endblock %} + +{% set charts = dbp.get_charts_tracks(filterkeys,limitkeys) %} + + +{% block content %} + + + + + + +
+
+
+

Track Charts

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

+ {{ htmlmodules.module_filterselection(_urikeys) }} + +
+ + +{% import 'partials/charts_tracks.jinja' as charts_tracks %} + +{{ charts_tracks.charts_tracks(filterkeys,limitkeys,amountkeys,charts=charts,compare=false) }} + + +{% endblock %} diff --git a/maloja/web/jinja/partials/charts_artists.jinja b/maloja/web/jinja/partials/charts_artists.jinja new file mode 100644 index 0000000..3049384 --- /dev/null +++ b/maloja/web/jinja/partials/charts_artists.jinja @@ -0,0 +1,41 @@ +{% macro charts_artists(limitkeys,amountkeys,charts=None,compare=False) %} + +{% if charts is none %} + {% set charts = dbp.get_charts_artists(limitkeys) %} +{% endif %} + +{% if compare %} +{% endif %} + +{% set firstindex = amountkeys.page * amountkeys.perpage %} +{% set lastindex = firstindex + amountkeys.perpage %} + + +{% set maxbar = charts[0]['scrobbles'] if charts != [] else 0 %} + + + {% for e in charts %} + {% if loop.index0 >= firstindex and loop.index0 < lastindex %} + + + + + {% if false %} + {% if e not in prevcharts %}{% endif %} + + {% endif %} + + + {{ htmlgenerators.entity_column(e['artist']) }} + + + + + + {% endif %} + {% endfor %} +
{%if loop.changed(e.scrobbles) %}#{{ e.rank }}{% endif %}🆕{{ htmlgenerators.scrobblesArtistLink(e['artist'],urihandler.internal_to_uri(limitkeys),amount=e['scrobbles']) }}{{ htmlgenerators.scrobblesArtistLink(e['artist'],urihandler.internal_to_uri(limitkeys),percent=e['scrobbles']*100/maxbar) }}
+ + + +{%- endmacro %} diff --git a/maloja/web/jinja/partials/charts_tracks.jinja b/maloja/web/jinja/partials/charts_tracks.jinja index f090ff3..9bfee8e 100644 --- a/maloja/web/jinja/partials/charts_tracks.jinja +++ b/maloja/web/jinja/partials/charts_tracks.jinja @@ -1,7 +1,8 @@ -{% macro charts_tracks(filterkeys,limitkeys,amountkeys,compare=False) %} +{% macro charts_tracks(filterkeys,limitkeys,amountkeys,charts=None,compare=False) %} - -{% set tracks = dbp.get_charts_tracks(filterkeys,limitkeys) %} +{% if charts is none %} + {% set charts = dbp.get_charts_tracks(filterkeys,limitkeys) %} +{% endif %} {% if compare %} {% if compare is true %} {% set compare = limitkeys.timerange.next(step=-1) %} @@ -9,11 +10,11 @@ {% set prevtracks = dbp.get_charts_tracks(filterkeys,{'timerange':compare}) %} {% set lastrank = {} %} - {% for t in tracks %} + {% for t in charts %} {% if lastrank.update({(t.track.artists,t.track.title):t.rank}) %}{% endif %} {% endfor %} - {% for t in tracks %} + {% for t in charts %} {% if (t.track.artists,t.track.title) in lastrank %} {% if t.update({'lastrank':lastrank[(t.track.artists,t.track.title)]}) %}{% endif %} {% endif %} @@ -24,10 +25,10 @@ {% set lastindex = firstindex + amountkeys.perpage %} -{% set maxbar = tracks[0]['scrobbles'] if tracks != [] else 0 %} +{% set maxbar = charts[0]['scrobbles'] if charts != [] else 0 %} - {% for e in tracks %} + {% for e in charts %} {% if loop.index0 >= firstindex and loop.index0 < lastindex %}