1
0
mirror of https://github.com/spl0k/supysonic.git synced 2024-12-22 08:56:17 +00:00

Fix getAlbumList2 for PostgreSQL

Closes #245 (for real)
This commit is contained in:
Alban Féron 2023-03-18 17:39:07 +01:00
parent 034a47d1d7
commit cf73d5a26d
No known key found for this signature in database
GPG Key ID: 8CE0313646D16165

View File

@ -142,7 +142,7 @@ def album_list_id3():
offset = int(offset) if offset else 0 offset = int(offset) if offset else 0
root = get_root_folder(mfid) root = get_root_folder(mfid)
query = Album.select().join(Track).group_by(Album) query = Album.select().join(Track).group_by(Album.id)
if root is not None: if root is not None:
query = query.where(Track.root_folder == root) query = query.where(Track.root_folder == root)
@ -171,7 +171,12 @@ def album_list_id3():
elif ltype == "alphabeticalByName": elif ltype == "alphabeticalByName":
query = query.order_by(Album.name) query = query.order_by(Album.name)
elif ltype == "alphabeticalByArtist": elif ltype == "alphabeticalByArtist":
query = query.switch().join(Artist).order_by(Artist.name, Album.name) query = (
query.switch()
.join(Artist)
.group_by_extend(Artist.id)
.order_by(Artist.name, Album.name)
)
elif ltype == "byYear": elif ltype == "byYear":
startyear = int(request.values["fromYear"]) startyear = int(request.values["fromYear"])
endyear = int(request.values["toYear"]) endyear = int(request.values["toYear"])