diff --git a/maloja/database/__init__.py b/maloja/database/__init__.py
index 048f1b2..f1ffc41 100644
--- a/maloja/database/__init__.py
+++ b/maloja/database/__init__.py
@@ -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
}
diff --git a/maloja/pkg_global/conf.py b/maloja/pkg_global/conf.py
index 05e8bc3..a4de766 100644
--- a/maloja/pkg_global/conf.py
+++ b/maloja/pkg_global/conf.py
@@ -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":{
diff --git a/maloja/web/jinja/abstracts/base.jinja b/maloja/web/jinja/abstracts/base.jinja
index 91806e6..dd6cc5c 100644
--- a/maloja/web/jinja/abstracts/base.jinja
+++ b/maloja/web/jinja/abstracts/base.jinja
@@ -40,7 +40,7 @@
{% block scripts %}{% endblock %}
-
+
{% block content %}
diff --git a/maloja/web/jinja/album.jinja b/maloja/web/jinja/album.jinja
index 6d7ebe1..64bfe60 100644
--- a/maloja/web/jinja/album.jinja
+++ b/maloja/web/jinja/album.jinja
@@ -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 @@
{{ links.links(album.artists) }}
{{ info.album.albumtitle | e }}
- {# awards.certs(album) #}
#{{ info.position }}
@@ -82,6 +85,7 @@
{{ awards.medals(info) }}
{{ awards.topweeks(info) }}
+ {{ awards.subcerts(info) }}
|
diff --git a/maloja/web/jinja/artist.jinja b/maloja/web/jinja/artist.jinja
index fe0a35c..25347bb 100644
--- a/maloja/web/jinja/artist.jinja
+++ b/maloja/web/jinja/artist.jinja
@@ -91,7 +91,7 @@
{{ awards.medals(info) }}
{{ awards.topweeks(info) }}
{% endif %}
- {{ awards.certs(artist) }}
+ {{ awards.subcerts(artist) }}
diff --git a/maloja/web/jinja/partials/awards_album.jinja b/maloja/web/jinja/partials/awards_album.jinja
index b9337a2..d83f0e0 100644
--- a/maloja/web/jinja/partials/awards_album.jinja
+++ b/maloja/web/jinja/partials/awards_album.jinja
@@ -1,3 +1,5 @@
+{% import 'snippets/links.jinja' as links %}
+
{% macro medals(info) %}
@@ -40,3 +42,39 @@
{%- endmacro %}
+
+
+
+
+{% macro certs(album) %}
+
+
+
+{% set info = db.album_info(album=album) %}
+{% if info.certification is not none %}
+
+{% endif %}
+
+{%- endmacro %}
+
+{% macro subcerts(album) %}
+
+
+
+{% 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 -%}
+
+ {%- endif %}
+
+{%- endfor %}
+
+{%- endmacro %}
\ No newline at end of file
diff --git a/maloja/web/jinja/partials/awards_artist.jinja b/maloja/web/jinja/partials/awards_artist.jinja
index 10bfecc..9492633 100644
--- a/maloja/web/jinja/partials/awards_artist.jinja
+++ b/maloja/web/jinja/partials/awards_artist.jinja
@@ -52,9 +52,9 @@
-{% macro certs(artist) %}
+{% macro subcerts(artist) %}
-
+
{% set charts = db.get_charts_tracks(artist=artist,timerange=malojatime.alltime()) %}
{% for e in charts -%}
diff --git a/maloja/web/jinja/track.jinja b/maloja/web/jinja/track.jinja
index f446c71..4aaf990 100644
--- a/maloja/web/jinja/track.jinja
+++ b/maloja/web/jinja/track.jinja
@@ -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 @@
{{ links.links(track.artists) }}
{{ info.track.title | e }}
- {{ awards.certs(track) }}
#{{ info.position }}
{% if info.track.album %}
diff --git a/maloja/web/static/css/maloja.css b/maloja/web/static/css/maloja.css
index 0828875..6241168 100644
--- a/maloja/web/static/css/maloja.css
+++ b/maloja/web/static/css/maloja.css
@@ -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"] {
|