mirror of
https://github.com/spl0k/supysonic.git
synced 2024-12-22 17:06:17 +00:00
Implemented getSong.view
This commit is contained in:
parent
a261d019a8
commit
6c6eb1c603
@ -107,3 +107,19 @@ def show_directory():
|
||||
|
||||
return request.formatter({ 'directory': directory })
|
||||
|
||||
@app.route('/rest/getSong.view', methods = [ 'GET', 'POST' ])
|
||||
def track_info():
|
||||
id = request.args.get('id')
|
||||
if not id:
|
||||
return request.error_formatter(10, 'Missing media id')
|
||||
|
||||
try:
|
||||
tid = uuid.UUID(id)
|
||||
except:
|
||||
return request.error_formatter(0, 'Invalid media id')
|
||||
|
||||
track = Track.query.get(tid)
|
||||
if not track:
|
||||
return request.error_formatter(70, 'Media not found'), 404
|
||||
|
||||
return request.formatter({ 'song': track.as_subsonic_child() })
|
||||
|
Loading…
Reference in New Issue
Block a user