From dd30ddec1cd0f507d648a1e6c4c0d7328909282f Mon Sep 17 00:00:00 2001 From: krateng Date: Sat, 28 Oct 2023 20:28:47 +0200 Subject: [PATCH] Fixed scrobble number for artists --- maloja/__main__.py | 5 +++-- maloja/database/__init__.py | 16 ++++++++-------- pyproject.toml | 2 +- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/maloja/__main__.py b/maloja/__main__.py index 7a26a47..5c4692f 100644 --- a/maloja/__main__.py +++ b/maloja/__main__.py @@ -141,10 +141,11 @@ def print_info(): print(col['lightblue']("Timezone: "),f"UTC{conf.malojaconfig['timezone']:+d}") print() try: - from setuptools.dist import pkg_resources + from importlib.metadata import distribution 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: + raise print("Could not determine dependency versions.") print() diff --git a/maloja/database/__init__.py b/maloja/database/__init__.py index 142139b..b496acd 100644 --- a/maloja/database/__init__.py +++ b/maloja/database/__init__.py @@ -625,18 +625,18 @@ def artist_info(dbconn=None,**keys): # TODO: find better solution if own_track_charts: c = own_track_charts[0] - scrobbles = c["scrobbles"] + tscrobbles = c["scrobbles"] threshold_gold, threshold_platinum, threshold_diamond = malojaconfig["SCROBBLES_GOLD","SCROBBLES_PLATINUM","SCROBBLES_DIAMOND"] - if scrobbles >= threshold_diamond: cert = "diamond" - elif scrobbles >= threshold_platinum: cert = "platinum" - elif scrobbles >= threshold_gold: cert = "gold" + if tscrobbles >= threshold_diamond: cert = "diamond" + elif tscrobbles >= threshold_platinum: cert = "platinum" + elif tscrobbles >= threshold_gold: cert = "gold" if own_album_charts: 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"] - if scrobbles >= threshold_diamond: cert = "diamond" - elif scrobbles >= threshold_platinum and cert != "diamond": cert = "platinum" - elif scrobbles >= threshold_gold and not cert: cert = "gold" + if ascrobbles >= threshold_diamond: cert = "diamond" + elif ascrobbles >= threshold_platinum and cert != "diamond": cert = "platinum" + elif ascrobbles >= threshold_gold and not cert: cert = "gold" twk = thisweek() tyr = thisyear() diff --git a/pyproject.toml b/pyproject.toml index a753370..44bfa75 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ name = "malojaserver" version = "3.1.5" description = "Self-hosted music scrobble database" readme = "./README.md" -requires-python = ">=3.7" +requires-python = ">=3.10" license = { file="./LICENSE" } authors = [ { name="Johannes Krattenmacher", email="maloja@dev.krateng.ch" } ]