Without this change the web plugin does not support path queries as
slashes are currently used for joining keywords in the QueryConverter.
Moreover, flask cannot distinguish between an URL encoded and a plain
'/' character during routing [0]. To work around this issue without
introducing a breaking change (i.e. removing the QueryConverter) use the
backslash character for path queries and convert it later on.
Fixes#3566
[0]: https://github.com/pallets/flask/issues/900
Converts bytes to unicode using util.text_string, assuming that the
string is a UTF-8 string.
If that fails, it falls back to a hardcoded fallback filename.
If the web plugin is behind a credential based http server and is
accessed by another in-browser client in another domain, the
specification of CORS requires the server to indicate it supports
such credentials.
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.
As suggested, changes around the for loop to make it a bit more
pythonic by using an if loop inside a normal for loop.
Signed-off-by: Mark Stenglein <mark@stengle.in>
This commit fixes issue #2532 by filtering out any byte values
added by any other extensions and decoding them to strings for the
JSON serializer.
It does not remove any of the keys, instead opting to just convert
them.
Signed-off-by: Mark Stenglein <mark@stengle.in>
the following API paths are added:
* /item/values/FIELD
* /album/values/FIELD
Both paths will deliver a json dictionary with the key 'values' containing a
list of unique values belonging to the requested table and field.
Sorting is possible by supplying the query argument "sort_key".
This feature is useful for remote clients, e.g. Mopidy-Beets:
* track genres: /item/unique/genre
* track languages: /album/unique/language
* album artists: /album/unique/albumartist?sort_key=albumartist_sort
* album years: /album/unique/year