mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Implemented top artists in jinja
This commit is contained in:
parent
0abf2aae39
commit
a45696ab62
32
maloja/web/jinja/partials/top_artists.jinja
Normal file
32
maloja/web/jinja/partials/top_artists.jinja
Normal file
@ -0,0 +1,32 @@
|
||||
{% macro top_artists(limitkeys,delimitkeys,amountkeys) %}
|
||||
|
||||
{% set ranges = dbp.get_top_artists(limitkeys,delimitkeys) %}
|
||||
|
||||
{% set maxbar = ranges|map(attribute="scrobbles")|max|default(1) %}
|
||||
{% if maxbar < 1 %}{% set maxbar = 1 %}{% endif %}
|
||||
|
||||
<table class="list">
|
||||
{% for e in ranges %}
|
||||
|
||||
{% set thisrange = e.range %}
|
||||
{% set artist = e.artist %}
|
||||
<tr>
|
||||
<td>{{ thisrange.desc() }}</td>
|
||||
|
||||
{% if artist is none %}
|
||||
<td><div></div></td>
|
||||
<td class='stats'>n/a</td>
|
||||
<td class='amount'>0</td>
|
||||
<td class='bar'></td>
|
||||
{% else %}
|
||||
{{ htmlgenerators.entity_column(artist,image=utilities.getArtistImage(artist,fast=True)) }}
|
||||
<td class='amount'>{{ htmlgenerators.scrobblesArtistLink(artist,thisrange.urikeys(),amount=e.scrobbles) }}</td>
|
||||
<td class='bar'> {{ htmlgenerators.scrobblesArtistLink(artist,thisrange.urikeys(),percent=e.scrobbles*100/maxbar) }}</td>
|
||||
{% endif %}
|
||||
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
||||
|
||||
{%- endmacro %}
|
@ -13,7 +13,7 @@
|
||||
<tr>
|
||||
<td>{{ thisrange.desc() }}</td>
|
||||
|
||||
{% if e.track is none %}
|
||||
{% if track is none %}
|
||||
<td><div></div></td>
|
||||
<td class='stats'>n/a</td>
|
||||
<td class='amount'>0</td>
|
||||
|
32
maloja/web/jinja/top_artists.jinja
Normal file
32
maloja/web/jinja/top_artists.jinja
Normal file
@ -0,0 +1,32 @@
|
||||
{% extends "abstracts/base.jinja" %}
|
||||
{% block title %}Maloja - #1 Artists{% endblock %}
|
||||
|
||||
|
||||
<!-- find representative -->
|
||||
|
||||
{% set entries = dbp.get_top_artists(limitkeys,delimitkeys) %}
|
||||
{% set repr = entries | find_representative('artist','scrobbles') %}
|
||||
{% set img = "/favicon.png" if repr is none else utilities.getArtistImage(repr.artist) %}
|
||||
|
||||
|
||||
{% block content %}
|
||||
<table class="top_info">
|
||||
<tr>
|
||||
<td class="image">
|
||||
<div style="background-image:url('{{ img }}')"></div>
|
||||
</td>
|
||||
<td class="text">
|
||||
<h1>#1 Artists</h1><br/>
|
||||
<span>{{ limitkeys.timerange.desc(prefix=True) }}</span>
|
||||
|
||||
<br/><br/>
|
||||
{{ htmlmodules.module_filterselection(_urikeys,delimit=True) }}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
{% import 'partials/top_artists.jinja' as top_artists %}
|
||||
{{ top_artists.top_artists(limitkeys,delimitkeys,amountkeys) }}
|
||||
|
||||
{% endblock %}
|
Loading…
Reference in New Issue
Block a user