Beets as Media Center on a Raspberry Pi

I encountered problems with Kodi on my Pi. Even though disks, keyboard and mouse are powered by a usb link I always see the yellow flash on the screen indicating that there is not enough power. The even bigger issue was the index mechanism of Kodi which obviously ran out of memory causing audio outages.

I am using beets on my desktop for quite a while. It is the fastest tool to search for metadata I know of. For example this command line shows all Tangos recorded by Pugliese in the year 1945

beet ls year:1945 genre:Tango albumartist:Pugliese

If I want to play the titles I can say:

beet play year:1945 genre:Tango albumartist:Pugliese

On my desktop beets pipes the playlist to VLC where I can use the normal graphical interface of VLC. I decided to use the command line tool rvlc on the Pi.

This is what I did to install beets in the Pi.

pyvenv beets

First I created a virtual environment for Python.

. beets/bin/activate
pip install beets

After activating the virtual environment I installed beets with pip. On my Pi pip was too old, so I had to update it before with pip install -U pip. The command above installed beets 1.4.7.

After the I copied the configuration of beets from my desktop to my Pi with scp and made some changes to the configuration. First of all I changed the location of the music folder and created a folder where I want to store the beets database. The format of the configuration file is YAML so the configuration is quite easy. The important entries are:

directory: /media/pi/music
library: ~/beetdata/musiclibrary.db
play:
  command: rvlc

Now I had to look into the documentation of beets to see how I can scan a files in the music directory without making changes to them. The command I used was:

beet import -c -A /media/pi/Musikdateien/Musik/

The option -c leaves the files untouched. The main command beet import takes files from an arbitrary location and copies them to the music folder. As I already had a music folder full of music this was not what I wanted. The option -A disables autotagging as all files are tagged beforehand.

My Pi needed some minutess to import all files. After the import was finished I can now play music on my Pi using the rvlc interface which gives me a lot of control.