Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand Down
6 changes: 2 additions & 4 deletions beetsstatistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down