A beets plugin to search tracks and save the result as playlists via HTTP.
- Provides a JSON REST API to search tracks.
- Allows to save searches as playlists.
python3 -m pip install beets-websearch
Enable the plugin and add a websearch
section to your beets config.yaml
as follows:
plugins:
- websearch
websearch
host: '127.0.0.1'
port: 5000
Once the websearch
plugin is enabled within your beets configuration, you can run it as follows:
beet websearch
You can browse the server at http://127.0.0.1:5000
.
To serve multiple beets web APIs using a single process, you can use the webrouter plugin.
Usage: beet websearch [options]
Options:
-h, --help show this help message and exit
-d, --debug debug mode
See OpenAPI definition.
The following assumes you have docker installed.
In case you make changes to the openapi.yaml
, you can validate them as follows:
make validate-openapi
Generate the server stub from the openapi.yaml (containerized):
make generate
Run the unit tests (containerized):
make test
Run the e2e tests (containerized):
make test-e2e
To test your plugin changes manually, you can run a shell within a beets docker container as follows:
make beets-sh
A temporary beets library is written to ./data
.
It can be removed by calling make clean-data
.
To download example data, run:
make example-data
To just start the server, run:
make beets-websearch
Now you can browse the executable API documentation at http://127.0.0.1:5000/docs
.
Example API call to search tracks: http://127.0.0.1:5000/tracks?query={%22artist%22:{%22contains%22:%20%22dengue%22},%22title%22:{%22contains%22:%22serpiente%22}}
.