mirror of
https://github.com/spl0k/supysonic.git
synced 2024-12-23 01:16:18 +00:00
Better errors on listings
This commit is contained in:
parent
27bd7bce0c
commit
c709fa7e29
@ -50,9 +50,12 @@ def rand_songs():
|
|||||||
if genre:
|
if genre:
|
||||||
query = query.find(Track.genre == genre)
|
query = query.find(Track.genre == genre)
|
||||||
if fid:
|
if fid:
|
||||||
query = query.find(Track.root_folder_id == fid)
|
if not store.find(Folder, Folder.id == fid, Folder.root == True).one():
|
||||||
count = query.count()
|
return request.error_formatter(70, 'Unknown folder')
|
||||||
|
|
||||||
|
query = query.find(Track.root_folder_id == fid)
|
||||||
|
|
||||||
|
count = query.count()
|
||||||
if not count:
|
if not count:
|
||||||
return request.formatter({ 'randomSongs': {} })
|
return request.formatter({ 'randomSongs': {} })
|
||||||
|
|
||||||
@ -70,6 +73,8 @@ def rand_songs():
|
|||||||
@app.route('/rest/getAlbumList.view', methods = [ 'GET', 'POST' ])
|
@app.route('/rest/getAlbumList.view', methods = [ 'GET', 'POST' ])
|
||||||
def album_list():
|
def album_list():
|
||||||
ltype, size, offset = map(request.values.get, [ 'type', 'size', 'offset' ])
|
ltype, size, offset = map(request.values.get, [ 'type', 'size', 'offset' ])
|
||||||
|
if not ltype:
|
||||||
|
return request.error_formatter(10, 'Missing type')
|
||||||
try:
|
try:
|
||||||
size = int(size) if size else 10
|
size = int(size) if size else 10
|
||||||
offset = int(offset) if offset else 0
|
offset = int(offset) if offset else 0
|
||||||
@ -120,6 +125,8 @@ def album_list():
|
|||||||
@app.route('/rest/getAlbumList2.view', methods = [ 'GET', 'POST' ])
|
@app.route('/rest/getAlbumList2.view', methods = [ 'GET', 'POST' ])
|
||||||
def album_list_id3():
|
def album_list_id3():
|
||||||
ltype, size, offset = map(request.values.get, [ 'type', 'size', 'offset' ])
|
ltype, size, offset = map(request.values.get, [ 'type', 'size', 'offset' ])
|
||||||
|
if not ltype:
|
||||||
|
return request.error_formatter(10, 'Missing type')
|
||||||
try:
|
try:
|
||||||
size = int(size) if size else 10
|
size = int(size) if size else 10
|
||||||
offset = int(offset) if offset else 0
|
offset = int(offset) if offset else 0
|
||||||
|
Loading…
Reference in New Issue
Block a user