1
0
mirror of https://github.com/spl0k/supysonic.git synced 2024-12-23 01:16:18 +00:00

Recently played API returns albums/folders that have been played at least once

Fixes #107
This commit is contained in:
spl0k 2018-08-27 15:51:01 +02:00
parent 040169020e
commit 9736622ce1

View File

@ -67,7 +67,7 @@ def album_list():
elif ltype == 'frequent': elif ltype == 'frequent':
query = query.order_by(lambda f: desc(avg(f.tracks.play_count))) query = query.order_by(lambda f: desc(avg(f.tracks.play_count)))
elif ltype == 'recent': elif ltype == 'recent':
query = query.order_by(lambda f: desc(max(f.tracks.last_play))) query = select(t.folder for t in Track if max(t.folder.tracks.last_play) is not None).order_by(lambda f: desc(max(f.tracks.last_play)))
elif ltype == 'starred': elif ltype == 'starred':
query = select(s.starred for s in StarredFolder if s.user.id == request.user.id and count(s.starred.tracks) > 0) query = select(s.starred for s in StarredFolder if s.user.id == request.user.id and count(s.starred.tracks) > 0)
elif ltype == 'alphabeticalByName': elif ltype == 'alphabeticalByName':
@ -99,7 +99,7 @@ def album_list_id3():
elif ltype == 'frequent': elif ltype == 'frequent':
query = query.order_by(lambda a: desc(avg(a.tracks.play_count))) query = query.order_by(lambda a: desc(avg(a.tracks.play_count)))
elif ltype == 'recent': elif ltype == 'recent':
query = query.order_by(lambda a: desc(max(a.tracks.last_play))) query = Album.select(lambda a: max(a.tracks.last_play) is not None).order_by(lambda a: desc(max(a.tracks.last_play)))
elif ltype == 'starred': elif ltype == 'starred':
query = select(s.starred for s in StarredAlbum if s.user.id == request.user.id) query = select(s.starred for s in StarredAlbum if s.user.id == request.user.id)
elif ltype == 'alphabeticalByName': elif ltype == 'alphabeticalByName':