1
0
mirror of https://github.com/spl0k/supysonic.git synced 2024-11-14 22:22:18 +00:00

fix searching problems

This commit is contained in:
Emory P 2014-02-01 02:34:18 -05:00
parent 1f8289e1c6
commit 1aa2a2c62b
3 changed files with 12 additions and 10 deletions

View File

@ -199,7 +199,7 @@ def cover_art():
app.logger.debug('No Art Found!')
res.has_cover_art = False
session.commit()
return request.error_formatter(70, 'Cover art not found')
return request.error_formatter(70, 'Cover art not found'), 404
coverfile = coverfile[0]
@ -208,7 +208,7 @@ def cover_art():
try:
size = int(size)
except:
return request.error_formatter(0, 'Invalid size value')
return request.error_formatter(0, 'Invalid size value'), 404
else:
app.logger.debug('Serving cover art: ' + res.path + coverfile)
return send_file(os.path.join(res.path, coverfile))

View File

@ -43,6 +43,7 @@ def old_search():
'match': [ r.as_subsonic_child(request.user) for r in query.slice(offset, offset + count) ]
}})
@app.route('/rest/search2.view', methods = [ 'GET', 'POST' ])
def new_search():
query, artist_count, artist_offset, album_count, album_offset, song_count, song_offset = map(
@ -61,8 +62,8 @@ def new_search():
if not query:
return request.error_formatter(10, 'Missing query parameter')
artist_query = Folder.query.filter(~ Folder.tracks.any(), Folder.name.contains(query)).slice(artist_offset, artist_offset + artist_count)
album_query = Folder.query.filter(Folder.tracks.any(), Folder.name.contains(query)).slice(album_offset, album_offset + album_count)
artist_query = Folder.query.filter(~ Folder.tracks.any(), Folder.path.contains(query)).slice(artist_offset, artist_offset + artist_count)
album_query = Folder.query.filter(Folder.tracks.any(), Folder.path.contains(query)).slice(album_offset, album_offset + album_count)
song_query = Track.query.filter(Track.title.contains(query)).slice(song_offset, song_offset + song_count)
return request.formatter({ 'searchResult2': {
@ -71,6 +72,7 @@ def new_search():
'song': [ t.as_subsonic_child(request.user) for t in song_query ]
}})
@app.route('/rest/search3.view', methods = [ 'GET', 'POST' ])
def search_id3():
query, artist_count, artist_offset, album_count, album_offset, song_count, song_offset = map(

View File

@ -9,6 +9,6 @@
touch-reload = /tmp/supysonic.reload
enable-threads = true
processes = 8
harakiri = 60
harakiri = 120
daemonize = uwsgi.log
close-on-exec = true