Custom REST API for beets (similar to AURA)


#1

Hello, I’m currently writing an REST API to interact with beets. My current plugin is built around Flask and used some information from LastFM to complement a music library with interesting information. Unfortunately, I’m not sure I understand how to access the local beets library from my Python code. I talked a bit with ‘sampsyo’ on the IRC and he suggested me to probably work with him on AURA to bring it to something usable but I would prefer to use Python to simplify the integration with beets current code base and the insane amount of Python libraries available.

What has been done:

  • Artist endpoints:
    • Search for given artist using name or MBID (/artists/<name or mbid>)
    • Search for similar artists using name or MBID (/artists/<name or mbid>/similar)
    • Search for simiar songs given an artist and song (/artists/<name or mbid>/songs/<track name or mbid>/similar)

The endpoints are currently working but I’m not able to cross-reference the information with a local library. When I’ll be able to do so, I’ll create a new repository or add the code to the AURA repository.


How to access flex attributes outside of Beets?
#2

Great! I’m glad you’re interested in this sort of thing.

First things first: have you seen the REST API plugin and web frontend that we ship with beets?
http://beets.readthedocs.io/en/v1.4.4/plugins/web.html

That was an inspiration for building a better, more complete API, which turned into the AURA proposal.

To better frame the discussion, what are you hoping to accomplish with the new API? It would be great to hear about intended differences with the old web plugin and the AURA API.


#3

I revisited the web plugin and I think what I’m trying to make is simply add features to the web plugin. There are no endpoints for artist information and I also want to learn more about doing REST API development with Python.

EDIT: I also plan on moving my API into the same direction as AURA to provide interfaces for mobile and desktop music players.


#4

Cool; that makes sense! The addition of more entities, like artists, is also part of what we intend to do with AURA.

A big item on the to-do list for the AURA project is to implement a new beets plugin—alongside the existing web plugin—that provides an AURA implementation. If this kind of API is what you’re after, perhaps I can convince you to implement (and perhaps improve along the way!) AURA instead of inventing a new protocol from scratch? This could be a fun project, and thinking carefully about how the API should work might make it useful for other developers as well.


#5

I uploaded my initial work on Github, if anyone wants to take a look at it or even help out that would be great!

Link to project: https://github.com/HazWard/AuraBeets