Fixed scrobble number for artists

This commit is contained in:
krateng 2023-10-28 20:28:47 +02:00
parent 25f25866a0
commit dd30ddec1c
3 changed files with 12 additions and 11 deletions

View File

@ -141,10 +141,11 @@ def print_info():
print(col['lightblue']("Timezone: "),f"UTC{conf.malojaconfig['timezone']:+d}") print(col['lightblue']("Timezone: "),f"UTC{conf.malojaconfig['timezone']:+d}")
print() print()
try: try:
from setuptools.dist import pkg_resources from importlib.metadata import distribution
for pkg in ("sqlalchemy","waitress","bottle","doreah","jinja2"): for pkg in ("sqlalchemy","waitress","bottle","doreah","jinja2"):
print(col['cyan'] (f"{pkg}:".ljust(13)),pkg_resources.get_distribution(pkg).version) print(col['cyan'] (f"{pkg}:".ljust(13)),distribution(pkg).version)
except ImportError: except ImportError:
raise
print("Could not determine dependency versions.") print("Could not determine dependency versions.")
print() print()

View File

@ -625,18 +625,18 @@ def artist_info(dbconn=None,**keys):
# TODO: find better solution # TODO: find better solution
if own_track_charts: if own_track_charts:
c = own_track_charts[0] c = own_track_charts[0]
scrobbles = c["scrobbles"] tscrobbles = c["scrobbles"]
threshold_gold, threshold_platinum, threshold_diamond = malojaconfig["SCROBBLES_GOLD","SCROBBLES_PLATINUM","SCROBBLES_DIAMOND"] threshold_gold, threshold_platinum, threshold_diamond = malojaconfig["SCROBBLES_GOLD","SCROBBLES_PLATINUM","SCROBBLES_DIAMOND"]
if scrobbles >= threshold_diamond: cert = "diamond" if tscrobbles >= threshold_diamond: cert = "diamond"
elif scrobbles >= threshold_platinum: cert = "platinum" elif tscrobbles >= threshold_platinum: cert = "platinum"
elif scrobbles >= threshold_gold: cert = "gold" elif tscrobbles >= threshold_gold: cert = "gold"
if own_album_charts: if own_album_charts:
c = own_album_charts[0] c = own_album_charts[0]
scrobbles = c["scrobbles"] ascrobbles = c["scrobbles"]
threshold_gold, threshold_platinum, threshold_diamond = malojaconfig["SCROBBLES_GOLD_ALBUM","SCROBBLES_PLATINUM_ALBUM","SCROBBLES_DIAMOND_ALBUM"] threshold_gold, threshold_platinum, threshold_diamond = malojaconfig["SCROBBLES_GOLD_ALBUM","SCROBBLES_PLATINUM_ALBUM","SCROBBLES_DIAMOND_ALBUM"]
if scrobbles >= threshold_diamond: cert = "diamond" if ascrobbles >= threshold_diamond: cert = "diamond"
elif scrobbles >= threshold_platinum and cert != "diamond": cert = "platinum" elif ascrobbles >= threshold_platinum and cert != "diamond": cert = "platinum"
elif scrobbles >= threshold_gold and not cert: cert = "gold" elif ascrobbles >= threshold_gold and not cert: cert = "gold"
twk = thisweek() twk = thisweek()
tyr = thisyear() tyr = thisyear()

View File

@ -3,7 +3,7 @@ name = "malojaserver"
version = "3.1.5" version = "3.1.5"
description = "Self-hosted music scrobble database" description = "Self-hosted music scrobble database"
readme = "./README.md" readme = "./README.md"
requires-python = ">=3.7" requires-python = ">=3.10"
license = { file="./LICENSE" } license = { file="./LICENSE" }
authors = [ { name="Johannes Krattenmacher", email="maloja@dev.krateng.ch" } ] authors = [ { name="Johannes Krattenmacher", email="maloja@dev.krateng.ch" } ]