Merge pull request #246 from xhochy/feature/add-content-length-header

Compute Content-Length to make tracks seekable in most players via the web plugin
This commit is contained in:
Adrian Sampson 2013-04-10 10:16:29 -07:00
commit d8d57cbf1b

View file

@ -76,7 +76,9 @@ def all_items():
@app.route('/item/<int:item_id>/file')
def item_file(item_id):
item = g.lib.get_item(item_id)
return flask.send_file(item.path, as_attachment=True, attachment_filename=os.path.basename(item.path))
response = flask.send_file(item.path, as_attachment=True, attachment_filename=os.path.basename(item.path))
response.headers['Content-Length'] = os.path.getsize(item.path)
return response
@app.route('/item/query/<path:query>')
def item_query(query):