mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Implemented pulse and performance in jinja
This commit is contained in:
parent
c6adc90d4b
commit
44a2739a3b
@ -5,7 +5,7 @@ author = {
|
||||
"email":"maloja@krateng.dev",
|
||||
"github": "krateng"
|
||||
}
|
||||
version = 2,7,10
|
||||
version = 2,7,11
|
||||
versionstr = ".".join(str(n) for n in version)
|
||||
links = {
|
||||
"pypi":"malojaserver",
|
||||
|
@ -542,7 +542,8 @@ def time_stamps(since=None,to=None,within=None,range=None):
|
||||
# return (stamp1,stamp2-1)
|
||||
|
||||
|
||||
|
||||
def delimit_desc_p(d):
|
||||
return delimit_desc(**d)
|
||||
|
||||
def delimit_desc(step="month",stepn=1,trail=1):
|
||||
txt = ""
|
||||
|
38
maloja/web/jinja/performance.jinja
Normal file
38
maloja/web/jinja/performance.jinja
Normal file
@ -0,0 +1,38 @@
|
||||
{% extends "abstracts/base.jinja" %}
|
||||
{% 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) %}
|
||||
{% elif filterkeys.get('artist') is not none %}
|
||||
{% set img = utilities.getArtistImage(filterkeys.artist,fast=True) %}
|
||||
{% else %}
|
||||
{% set img = "/favicon.png" %}
|
||||
{% endif %}
|
||||
|
||||
{% block content %}
|
||||
<table class="top_info">
|
||||
<tr>
|
||||
<td class="image">
|
||||
<div style="background-image:url('{{ img }}')"></div>
|
||||
</td>
|
||||
<td class="text">
|
||||
<h1>{{ malojatime.delimit_desc_p(delimitkeys) }} Performance</h1>
|
||||
{% if limitkeys != {} %}
|
||||
<a href="/pulse?{{ urihandler.compose_from_dicts(filterkeys,limitkeys,delimitkeys) }}"><span>View Pulse</span></a>
|
||||
{% endif %}
|
||||
<br/>
|
||||
{{ filterdesc.desc(filterkeys,limitkeys,prefix='of') }}
|
||||
<br/><br/>
|
||||
{{ htmlmodules.module_filterselection(_urikeys,delimit=True) }}
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
{{ performance.performance(filterkeys,limitkeys,delimitkeys,amountkeys) }}
|
||||
|
||||
{% endblock %}
|
38
maloja/web/jinja/pulse.jinja
Normal file
38
maloja/web/jinja/pulse.jinja
Normal file
@ -0,0 +1,38 @@
|
||||
{% extends "abstracts/base.jinja" %}
|
||||
{% 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) %}
|
||||
{% elif filterkeys.get('artist') is not none %}
|
||||
{% set img = utilities.getArtistImage(filterkeys.artist,fast=True) %}
|
||||
{% else %}
|
||||
{% set img = "/favicon.png" %}
|
||||
{% endif %}
|
||||
|
||||
{% block content %}
|
||||
<table class="top_info">
|
||||
<tr>
|
||||
<td class="image">
|
||||
<div style="background-image:url('{{ img }}')"></div>
|
||||
</td>
|
||||
<td class="text">
|
||||
<h1>{{ malojatime.delimit_desc_p(delimitkeys) }} Pulse</h1>
|
||||
{% if filterkeys != {} %}
|
||||
<a href="/performance?{{ urihandler.compose_from_dicts(filterkeys,limitkeys,delimitkeys) }}"><span>View Rankings</span></a>
|
||||
{% endif %}
|
||||
<br/>
|
||||
{{ filterdesc.desc(filterkeys,limitkeys,prefix='of') }}
|
||||
<br/><br/>
|
||||
{{ htmlmodules.module_filterselection(_urikeys,delimit=True) }}
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
{{ pulse.pulse(filterkeys,limitkeys,delimitkeys,amountkeys) }}
|
||||
|
||||
{% endblock %}
|
@ -1,7 +1,12 @@
|
||||
{% extends "abstracts/base.jinja" %}
|
||||
{% 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) %}
|
||||
{% set pages = math.ceil(scrobbles.__len__() / amountkeys.perpage) %}
|
||||
|
||||
{% if filterkeys.get('track') is not none %}
|
||||
{% set img = utilities.getTrackImage(artists=filterkeys.track.artists,title=filterkeys.track.title,fast=True) %}
|
||||
@ -23,13 +28,8 @@
|
||||
</td>
|
||||
<td class="text">
|
||||
<h1>Scrobbles</h1><br/>
|
||||
{% 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 %}
|
||||
<span>{{ limitkeys.timerange.desc(prefix=True) }}</span><br/>
|
||||
{{ filterdesc.desc(filterkeys,limitkeys) }}
|
||||
<br/>
|
||||
<p class="stats">{{ scrobbles.__len__() }} Scrobbles</p>
|
||||
<br/>
|
||||
{{ htmlmodules.module_filterselection(_urikeys) }}
|
||||
@ -38,8 +38,10 @@
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
{% import 'partials/scrobbles.jinja' as scrobbles %}
|
||||
{{ scrobbles.scrobbles(filterkeys,limitkeys,amountkeys) }}
|
||||
|
||||
{{ scrobblemodule.scrobbles(filterkeys,limitkeys,amountkeys) }}
|
||||
|
||||
{{ pagination.pagination(filterkeys,limitkeys,delimitkeys,amountkeys,pages) }}
|
||||
|
||||
|
||||
{% endblock %}
|
||||
|
11
maloja/web/jinja/snippets/filterdescription.jinja
Normal file
11
maloja/web/jinja/snippets/filterdescription.jinja
Normal file
@ -0,0 +1,11 @@
|
||||
{% macro desc(filterkeys,limitkeys,prefix="by") %}
|
||||
|
||||
{% if filterkeys.get('artist') is not none %}
|
||||
{{ prefix }} {{ 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) }}
|
||||
|
||||
{% endmacro %}
|
Loading…
Reference in New Issue
Block a user