1
0
mirror of https://github.com/spl0k/supysonic.git synced 2024-11-09 19:52:16 +00:00

Genre related fixes

Fix /getGenres for DBMSs other tha SQLite
Don't list an empty genre

Ref #241
This commit is contained in:
Alban Féron 2023-01-15 16:26:59 +01:00
parent ad688a23c3
commit d5a4f1856c
No known key found for this signature in database
GPG Key ID: 8CE0313646D16165

View File

@ -139,8 +139,9 @@ def list_genres():
"genre": [
{"value": genre, "songCount": sc, "albumCount": ac}
for genre, sc, ac in Track.select(
Track.genre, fn.count(), fn.count(Track.album.distinct())
Track.genre, fn.count("*"), fn.count(Track.album.distinct())
)
.where(Track.genre.is_null(False))
.group_by(Track.genre)
.tuples()
]