Fix album_art() in __init__.py
flask.send_file() expects a string, g.lib.get_album() returns bytes. Added decode() to album_art().
If g.lib.get_album() gets a non-existing id, it returns None. Python would throw an error in this case. Added check to prevent this.
@@ -285,8 +285,8 @@ def album_query(queries):
@app.route('/album/<int:album_id>/art')
def album_art(album_id):
album = g.lib.get_album(album_id)
- if album.artpath:
- return flask.send_file(album.artpath)
+ if album and album.artpath:
+ return flask.send_file(album.artpath.decode())
else:
return flask.abort(404)
