mirror of
https://github.com/spl0k/supysonic.git
synced 2024-11-13 21:52:18 +00:00
Added getSongsByGenre
This commit is contained in:
parent
ac306f2725
commit
6b86f3a43a
10
docs/api.md
10
docs/api.md
@ -51,7 +51,7 @@ or with version 1.8.0.
|
|||||||
| [`getAlbumList`](#getalbumlist) | | ✔️ |
|
| [`getAlbumList`](#getalbumlist) | | ✔️ |
|
||||||
| [`getAlbumList2`](#getalbumlist2) | | ✔️ |
|
| [`getAlbumList2`](#getalbumlist2) | | ✔️ |
|
||||||
| [`getRandomSongs`](#getrandomsongs) | | ✔️ |
|
| [`getRandomSongs`](#getrandomsongs) | | ✔️ |
|
||||||
| [`getSongsByGenre`](#getsongsbygenre) | 1.9.0 | 📅 |
|
| [`getSongsByGenre`](#getsongsbygenre) | 1.9.0 | ✔️ |
|
||||||
| [`getNowPlaying`](#getnowplaying) | | ✔️ |
|
| [`getNowPlaying`](#getnowplaying) | | ✔️ |
|
||||||
| [`getStarred`](#getstarred) | | ✔️ |
|
| [`getStarred`](#getstarred) | | ✔️ |
|
||||||
| [`getStarred2`](#getstarred2) | | ✔️ |
|
| [`getStarred2`](#getstarred2) | | ✔️ |
|
||||||
@ -308,13 +308,13 @@ On 1.10.1, `byYear` and `byGenre` were added to `type`
|
|||||||
| `musicFolderId` | | ✔️ |
|
| `musicFolderId` | | ✔️ |
|
||||||
|
|
||||||
#### `getSongsByGenre`
|
#### `getSongsByGenre`
|
||||||
📅 1.9.0
|
✔️ 1.9.0
|
||||||
|
|
||||||
| Parameter | Vers. | |
|
| Parameter | Vers. | |
|
||||||
|-----------------|--------|---|
|
|-----------------|--------|---|
|
||||||
| `genre` | 1.9.0 | 📅 |
|
| `genre` | 1.9.0 | ✔️ |
|
||||||
| `count` | 1.9.0 | 📅 |
|
| `count` | 1.9.0 | ✔️ |
|
||||||
| `offset` | 1.9.0 | 📅 |
|
| `offset` | 1.9.0 | ✔️ |
|
||||||
| `musicFolderId` | 1.12.0 | 📅 |
|
| `musicFolderId` | 1.12.0 | 📅 |
|
||||||
|
|
||||||
#### `getNowPlaying`
|
#### `getNowPlaying`
|
||||||
|
@ -113,6 +113,19 @@ def album_list_id3():
|
|||||||
album = [ f.as_subsonic_album(request.user) for f in query.limit(size, offset) ]
|
album = [ f.as_subsonic_album(request.user) for f in query.limit(size, offset) ]
|
||||||
))
|
))
|
||||||
|
|
||||||
|
@api.route('/getSongsByGenre.view', methods = [ 'GET', 'POST' ])
|
||||||
|
def songs_by_genre():
|
||||||
|
genre = request.values['genre']
|
||||||
|
|
||||||
|
count, offset = map(request.values.get, [ 'count', 'offset' ])
|
||||||
|
count = int(count) if count else 10
|
||||||
|
offset = int(offset) if offset else 0
|
||||||
|
|
||||||
|
query = select(t for t in Track if t.genre == genre).limit(count, offset)
|
||||||
|
return request.formatter('songsByGenre', dict(
|
||||||
|
song = [ t.as_subsonic_child(request.user, request.client) for t in query ]
|
||||||
|
))
|
||||||
|
|
||||||
@api.route('/getNowPlaying.view', methods = [ 'GET', 'POST' ])
|
@api.route('/getNowPlaying.view', methods = [ 'GET', 'POST' ])
|
||||||
def now_playing():
|
def now_playing():
|
||||||
query = User.select(lambda u: u.last_play is not None and u.last_play_date + timedelta(minutes = 3) > now())
|
query = User.select(lambda u: u.last_play is not None and u.last_play_date + timedelta(minutes = 3) > now())
|
||||||
|
Loading…
Reference in New Issue
Block a user