From 96870a4ab2950292edd2837db4f1e7d2952fea3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20Gilli=C3=9Fen?= Date: Mon, 5 Jan 2026 15:43:11 +0100 Subject: [PATCH] feat(genres): skip n/a as genre, list 25 top genres --- app.py | 2 +- beetsstatistics.py | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/app.py b/app.py index 027550e..4a1a203 100644 --- a/app.py +++ b/app.py @@ -139,7 +139,7 @@ async def get_genre_count( request: Request, beets_statistics: Annotated[BeetsStatistics, Depends(get_beets_statistics)], ): - genres = beets_statistics.get_genre_count(limit=20) + genres = beets_statistics.get_genre_count(limit=30) genre_list = [] count_list = [] for genre in genres[0]: diff --git a/beetsstatistics.py b/beetsstatistics.py index 7922850..83b4528 100644 --- a/beetsstatistics.py +++ b/beetsstatistics.py @@ -121,13 +121,11 @@ def get_genre_count(self, limit: int = 0): cursor = self.get_db_connection().cursor() res = cursor.execute( """select - case - when a.genre = '' then "n/a" - else ifnull(case when instr(a.genre, ';') then substr(a.genre, 0, instr(a.genre, ';')) else a.genre end , "n/a") - end as genre, + ifnull(case when instr(a.genre, ';') then substr(a.genre, 0, instr(a.genre, ';')) else a.genre end , "n/a") as genre, count(1) as count from albums a + where a.genre != '' group by a.genre order by