Skip to content

A beets plugin that provides a simple REST API

License

Notifications You must be signed in to change notification settings

calne-ca/beets-plugin-restapi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyPI version

Beets REST API Plugin

This is a plugin for the music management tool beets.
This plugin provides a simple REST API for your music library.

The API is similar to the API provided by the official beets web plugin. In contrast to the web plugin this plugin does not provide a web interface though. With this plugin I addressed some issues in the official web plugin's api that made it unusable for me.

API

The table below shows all interfaces currently provided by the API:

Method Path Description Parameters Response Type
GET /items Get a list of all items matching a certain query query:
A beets query
application/json
GET /item/{itemId}/file Download the audio file for an item - application/octet-stream
GET /item/{itemId}/art Download the cover art for an item. size (optional):
If provided returns the image
with a resolution of size x size
image/jpeg

Setup

Install the plugin

pip install beets-rest-api  

Configure the plugin

Edit your beets configuration file and add the following section:

restapi:
    host: 0.0.0.0   # The IP address the web server should bind to
    port: 8338      # The port the web server should bind to

Also add restapi to the plugins section.

Run the plugin

You can start the plugin by running:

beet restapi

This will start a web server and block the command execution. If you want to run it in the background you can run it this way instead:

beet restapi &>/dev/null &    # Unix

If the web server should always run you can add this code to a script file and add it to the autostart (Windows), crontab (Unix) or any other way of running a script on system startup.