1
0
mirror of https://github.com/spl0k/supysonic.git synced 2024-12-22 08:56:17 +00:00

Implemented getSong.view

This commit is contained in:
Alban 2012-12-01 20:12:35 +01:00
parent a261d019a8
commit 6c6eb1c603

View File

@ -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() })