mirror of
https://github.com/krateng/maloja.git
synced 2025-04-22 19:40:28 +03:00
Added album certifications and changed certification design
This commit is contained in:
parent
9bc7d881d8
commit
cd846c1abe
@ -624,6 +624,11 @@ def album_info(dbconn=None,**keys):
|
||||
c = [e for e in alltimecharts if e["album"] == album][0]
|
||||
scrobbles = c["scrobbles"]
|
||||
position = c["rank"]
|
||||
cert = None
|
||||
threshold_gold, threshold_platinum, threshold_diamond = malojaconfig["SCROBBLES_GOLD_ALBUM","SCROBBLES_PLATINUM_ALBUM","SCROBBLES_DIAMOND_ALBUM"]
|
||||
if scrobbles >= threshold_diamond: cert = "diamond"
|
||||
elif scrobbles >= threshold_platinum: cert = "platinum"
|
||||
elif scrobbles >= threshold_gold: cert = "gold"
|
||||
|
||||
return {
|
||||
"album":album,
|
||||
@ -634,6 +639,7 @@ def album_info(dbconn=None,**keys):
|
||||
"silver": [year for year in cached.medals_albums if album_id in cached.medals_albums[year]['silver']],
|
||||
"bronze": [year for year in cached.medals_albums if album_id in cached.medals_albums[year]['bronze']],
|
||||
},
|
||||
"certification":cert,
|
||||
"topweeks":len([e for e in cached.weekly_topalbums if e == album_id]),
|
||||
"id":album_id
|
||||
}
|
||||
|
@ -155,9 +155,12 @@ malojaconfig = Configuration(
|
||||
"use_global_cache":(tp.Boolean(), "Use global DB Cache", True)
|
||||
},
|
||||
"Fluff":{
|
||||
"scrobbles_gold":(tp.Integer(), "Scrobbles for Gold", 250, "How many scrobbles a track needs to be considered 'Gold' status"),
|
||||
"scrobbles_platinum":(tp.Integer(), "Scrobbles for Platinum", 500, "How many scrobbles a track needs to be considered 'Platinum' status"),
|
||||
"scrobbles_diamond":(tp.Integer(), "Scrobbles for Diamond", 1000, "How many scrobbles a track needs to be considered 'Diamond' status"),
|
||||
"scrobbles_gold":(tp.Integer(), "Scrobbles for Gold (Track)", 250, "How many scrobbles a track needs to be considered 'Gold' status"),
|
||||
"scrobbles_platinum":(tp.Integer(), "Scrobbles for Platinum (Track)",500, "How many scrobbles a track needs to be considered 'Platinum' status"),
|
||||
"scrobbles_diamond":(tp.Integer(), "Scrobbles for Diamond (Track)",1000, "How many scrobbles a track needs to be considered 'Diamond' status"),
|
||||
"scrobbles_gold_album":(tp.Integer(), "Scrobbles for Gold (Album)", 500, "How many scrobbles an album needs to be considered 'Gold' status"),
|
||||
"scrobbles_platinum_album":(tp.Integer(), "Scrobbles for Platinum (Album)",750, "How many scrobbles an album needs to be considered 'Platinum' status"),
|
||||
"scrobbles_diamond_album":(tp.Integer(), "Scrobbles for Diamond (Album)",1500, "How many scrobbles an album needs to be considered 'Diamond' status"),
|
||||
"name":(tp.String(), "Name", "Generic Maloja User")
|
||||
},
|
||||
"Third Party Services":{
|
||||
|
@ -40,7 +40,7 @@
|
||||
{% block scripts %}{% endblock %}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<body class="{% block custombodyclasses %}{% endblock %}">
|
||||
|
||||
{% block content %}
|
||||
|
||||
|
@ -15,6 +15,10 @@
|
||||
|
||||
{% set encodedalbum = mlj_uri.uriencode({'album':album}) %}
|
||||
|
||||
{% block custombodyclasses %}
|
||||
{% if info.certification %}certified certified_{{ info.certification }}{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% block icon_bar %}
|
||||
{% if adminmode %}
|
||||
@ -68,7 +72,6 @@
|
||||
<td class="text">
|
||||
<span>{{ links.links(album.artists) }}</span><br/>
|
||||
<h1 id="main_entity_name" class="headerwithextra">{{ info.album.albumtitle | e }}</h1>
|
||||
{# awards.certs(album) #}
|
||||
<span class="rank"><a href="/charts_albums?max=100">#{{ info.position }}</a></span>
|
||||
<br/>
|
||||
|
||||
@ -82,6 +85,7 @@
|
||||
|
||||
{{ awards.medals(info) }}
|
||||
{{ awards.topweeks(info) }}
|
||||
{{ awards.subcerts(info) }}
|
||||
|
||||
|
||||
</td>
|
||||
|
@ -91,7 +91,7 @@
|
||||
{{ awards.medals(info) }}
|
||||
{{ awards.topweeks(info) }}
|
||||
{% endif %}
|
||||
{{ awards.certs(artist) }}
|
||||
{{ awards.subcerts(artist) }}
|
||||
|
||||
|
||||
</td>
|
||||
|
@ -1,3 +1,5 @@
|
||||
{% import 'snippets/links.jinja' as links %}
|
||||
|
||||
{% macro medals(info) %}
|
||||
|
||||
<!-- MEDALS -->
|
||||
@ -40,3 +42,39 @@
|
||||
</span>
|
||||
|
||||
{%- endmacro %}
|
||||
|
||||
|
||||
|
||||
|
||||
{% macro certs(album) %}
|
||||
|
||||
<!-- CERTS -->
|
||||
|
||||
{% set info = db.album_info(album=album) %}
|
||||
{% if info.certification is not none %}
|
||||
<img class="certrecord"
|
||||
src="/media/record_{{ info.certification }}.png"
|
||||
title="This album has reached {{ info.certification.capitalize() }} status" />
|
||||
{% endif %}
|
||||
|
||||
{%- endmacro %}
|
||||
|
||||
{% macro subcerts(album) %}
|
||||
|
||||
<!-- SUBCERTS -->
|
||||
|
||||
{% set charts = db.get_charts_tracks(album=album.album,timerange=malojatime.alltime()) %}
|
||||
{% for e in charts -%}
|
||||
{%- if e.scrobbles >= settings.scrobbles_gold -%}{% set cert = 'gold' %}{%- endif -%}
|
||||
{%- if e.scrobbles >= settings.scrobbles_platinum -%}{% set cert = 'platinum' %}{%- endif -%}
|
||||
{%- if e.scrobbles >= settings.scrobbles_diamond -%}{% set cert = 'diamond' %}{%- endif -%}
|
||||
|
||||
{%- if cert -%}
|
||||
<a href='{{ links.url(e.track) }}'><img class="certrecord_small"
|
||||
src="/media/record_{{ cert }}.png"
|
||||
title="{{ e.track.title }} has reached {{ cert.capitalize() }} status" /></a>
|
||||
{%- endif %}
|
||||
|
||||
{%- endfor %}
|
||||
|
||||
{%- endmacro %}
|
@ -52,9 +52,9 @@
|
||||
|
||||
|
||||
|
||||
{% macro certs(artist) %}
|
||||
{% macro subcerts(artist) %}
|
||||
|
||||
<!-- CERTS -->
|
||||
<!-- SUBCERTS -->
|
||||
|
||||
{% set charts = db.get_charts_tracks(artist=artist,timerange=malojatime.alltime()) %}
|
||||
{% for e in charts -%}
|
||||
|
@ -20,6 +20,9 @@
|
||||
|
||||
{% set encodedtrack = mlj_uri.uriencode({'track':track}) %}
|
||||
|
||||
{% block custombodyclasses %}
|
||||
{% if info.certification %}certified certified_{{ info.certification }}{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block icon_bar %}
|
||||
{% if adminmode %}
|
||||
@ -69,7 +72,6 @@
|
||||
<td class="text">
|
||||
<span>{{ links.links(track.artists) }}</span><br/>
|
||||
<h1 id="main_entity_name" class="headerwithextra">{{ info.track.title | e }}</h1>
|
||||
{{ awards.certs(track) }}
|
||||
<span class="rank"><a href="/charts_tracks?max=100">#{{ info.position }}</a></span>
|
||||
<br/>
|
||||
{% if info.track.album %}
|
||||
|
@ -1,5 +1,10 @@
|
||||
@import url("/grisons.css");
|
||||
|
||||
:root {
|
||||
--color-diamond: 103, 161, 253;
|
||||
--color-platinum: 229, 228, 226;
|
||||
--color-gold: 255,215,0;
|
||||
}
|
||||
|
||||
body {
|
||||
padding:15px;
|
||||
@ -13,6 +18,23 @@ body {
|
||||
*/
|
||||
}
|
||||
|
||||
body.certified {
|
||||
background: radial-gradient(circle at top left, rgba(var(--bg_special_color),0.5) 0%, var(--current-bg-color) 20%);
|
||||
background-position: top left;
|
||||
background-repeat: no-repeat;
|
||||
background-attachment: fixed;
|
||||
height:100%;
|
||||
}
|
||||
body.certified.certified_diamond {
|
||||
--bg_special_color: var(--color-diamond);
|
||||
}
|
||||
body.certified.certified_platinum{
|
||||
--bg_special_color: var(--color-platinum);
|
||||
}
|
||||
body.certified.certified_gold {
|
||||
--bg_special_color: var(--color-gold);
|
||||
}
|
||||
|
||||
|
||||
|
||||
input[type="date"] {
|
||||
|
Loading…
x
Reference in New Issue
Block a user