From c6adc90d4be76aa7fc1a150d458d6d5d4bcbd367 Mon Sep 17 00:00:00 2001 From: Krateng Date: Sun, 30 Aug 2020 02:05:54 +0200 Subject: [PATCH] Implemented scrobbles in jinja --- maloja/web/jinja/scrobbles.jinja | 45 +++++++++++++++++++++++ maloja/web/jinja/snippets/entityrow.jinja | 7 ++++ 2 files changed, 52 insertions(+) create mode 100644 maloja/web/jinja/scrobbles.jinja diff --git a/maloja/web/jinja/scrobbles.jinja b/maloja/web/jinja/scrobbles.jinja new file mode 100644 index 0000000..c5098a8 --- /dev/null +++ b/maloja/web/jinja/scrobbles.jinja @@ -0,0 +1,45 @@ +{% extends "abstracts/base.jinja" %} +{% block title %}Maloja - Scrobbles{% endblock %} + +{% set scrobbles = dbp.get_scrobbles(filterkeys,limitkeys,amountkeys) %} + +{% if filterkeys.get('track') is not none %} + {% set img = utilities.getTrackImage(artists=filterkeys.track.artists,title=filterkeys.track.title,fast=True) %} +{% elif filterkeys.get('artist') is not none %} + {% set img = utilities.getArtistImage(filterkeys.artist,fast=True) %} +{% elif scrobbles.__len__() > 0 %} + {% set img = utilities.getTrackImage(artists=scrobbles[0].artists,title=scrobbles[0].title,fast=True) %} +{% else %} + {% set img = "/favicon.png" %} +{% endif %} + +{% block content %} + + + + + + + +
+
+
+

Scrobbles


+ {% if filterkeys.get('artist') is not none %} + by {{ htmlgenerators.artistLink(filterkeys.get('artist')) }} + {% elif filterkeys.get('track') is not none %} + of {{ htmlgenerators.trackLink(filterkeys.get('track')) }} + by {{ htmlgenerators.artistLinks(filterkeys["track"]["artists"]) }} + {% endif %} + {{ limitkeys.timerange.desc(prefix=True) }}
+

{{ scrobbles.__len__() }} Scrobbles

+
+ {{ htmlmodules.module_filterselection(_urikeys) }} + +
+ + {% import 'partials/scrobbles.jinja' as scrobbles %} + {{ scrobbles.scrobbles(filterkeys,limitkeys,amountkeys) }} + + +{% endblock %} diff --git a/maloja/web/jinja/snippets/entityrow.jinja b/maloja/web/jinja/snippets/entityrow.jinja index 0e39a9f..8826135 100644 --- a/maloja/web/jinja/snippets/entityrow.jinja +++ b/maloja/web/jinja/snippets/entityrow.jinja @@ -1,5 +1,12 @@ {% macro row(entity,counting=[]) %} +{% if 'artists' in entity %} + {% set img = utilities.getTrackImage(artists=entity.artists,title=entity.title,fast=True) %} +{% else %} + {% set img = utilities.getArtistImage(entity,fast=True) %} +{% endif %} + +
{% if "artists" in entity %} {{ htmlgenerators.html_links(entity.artists) }} – {{ htmlgenerators.html_link(entity) }}