From The World according to Vissie
Jump to navigation Jump to search


Beets is the media library management system for obsessive-compulsive music geeks.

sudo apt-get install beets

But the version in the repositories might lag behind, so make sure you read the right version of these docs. If you want the latest version, you can get everything you need to install with pip as described below by running:

sudo apt-get install python-dev python-pip
sudo pip install beets

If you have issues that you can not run beet, try:

sudo ln -s /usr/local/bin/beet /usr/bin/beet

I would recommend getting MediaInfo. Its a great tool.

sudo apt-get install mediainfo

Beets supports zip and tar archives out of the box. To extract rar files, install the rarfile package and the unrar command.

sudo apt-get install rar unrar atool


Chromaprint/Acoustid Plugin

U will need Chromaprint.

sudo pip install pyacoustid
sudo apt-get install libchromaprint-tools python-gi

Get a api key from

U need gstreamer

sudo apt-get install gstreamer-tools (gstreamer1.0-tools in stretch)

U need codecs

sudo apt-get install gstreamer0.10-plugins-good gstreamer0.10-plugins-bad gstreamer0.10-plugins-ugly libmp3lame-dev
sudo apt-get install gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly libmp3lame-dev (Stretch)

The discogs plugin extends the autotagger’s search capabilities to include matches from the Discogs database.

sudo pip install discogs-client


Fetch Lyrics During Import

To automatically fetch lyrics for songs you import, enable the lyrics plugin in your configuration (see Using Plugins). Then, install the requests library by typing:

sudo pip install requests

To activate Google Custom Search, using the Google backend requires BeautifulSoup, which you can install using pip by typing:

pip install beautifulsoup4

You also need to register for a Google API key. Set the google_API_key configuration option to your key. Then add google to the list of sources in your configuration (or use default list, which includes it as long as you have an API key). If you use default google_engine_ID, we recommend limiting the sources to musixmatch google as the other sources are already included in the Google results.

EmbedArt Plugin

sudo apt-get install imagemagick

AcousticBrainz Submit Plugin

aunpack essentia-extractor-v2.1_beta2-linux-x86_64.tar.gz
sudo mv ~/Downloads/streaming_extractor_music /usr/bin/

To configure the plugin, make a absubmit: section in your configuration file. The available options are:

auto: Analyze every file on import. Otherwise, you need to use the beet absubmit command explicitly. Default: no


Editor and Shell

echo $EDITOR

For me that produces "vim". If you want to change your default editor simply put a line in ~/.bashrc that changes it. Mine looks like this:

export EDITOR='vim'


beet -c ~/beets/Paula_beets.yaml convert -f mp3 'The Day Before You Came' -d ~/Downloads/

To keep the converted file, use the --keep (-k) option:

beet -c ~/beets/Paula_beets.yaml convert -f mp3 'The Day Before You Came' -k -d ~/Downloads/

To find all Window Media files and convert them, in place, use the following:

beet -c ~/beets/Paula_beets.yaml convert -f mp3 format:'Windows Media' -k -d ~/Downloads/


beet config -e
vim ~/.config/beets/config.yaml
vim: ~/.config/beet/config.yaml
# Beets configuration --------------------------------------------------------

directory: ~/Music
library:   ~/Music/music_lib.db


    move: no
    log: ~/Music/beet.log
    write: yes

# Paths ----------------------------------------------------------------------
# Paths and filenames for music files
# relative to music directory
    default: $albumartist/$album%aunique{}/$artist - $track - $title
    singleton: $albumartist/$artist - $title
    comp: $album%aunique{}/$artist - $track - $title

# replace special characters in generated filenames
#     '[\\/]': _
#     '^\.': _
#     '[\x00-\x1f]': _
#     '[<>:"\?\*\|]': _
#     '\.$': _
#     '\s+$': ''

# use mutliple threads during import
# threaded: yes
# timeout: 5.0
# verbose: no

    color: yes
    list_format_item: %upper{$artist} - $album - $track. $title
    list_format_album: %upper{$albumartist} - $album
    time_format: '%Y-%m-%d %H:%M:%S'
    terminal_encoding: utf8
        text_success: green
        text_warning: yellow
        text_error: red
        text_highlight: red
        text_highlight_minor: lightgray
        action_default: turquoise
        action: blue

    apikey: XXxxXXxxXX

    auto: yes

    itemfields: acoustid_id album albumartist artist average_loudness bitrate channels comments disc disctotal format gender genre length path samplerate title track tracktotal year
# Auto Tagger ----------------------------------------------------------------
    strong_rec_thresh: 0.1      # match 90% or better for auto import
    medium_rec_thresh: 0.25
    rec_gap_thresh: 0.25
        missing_tracks: medium
        unmatched_tracks: medium
        source: 2.0
        artist: 3.0
        album: 3.0
        media: 1.0
        mediums: 1.0
        year: 1.0
        country: 0.5
        label: 0.5
        catalognum: 0.5
        albumdisambig: 0.5
        album_id: 5.0
        tracks: 2.0
        missing_tracks: 0.9
        unmatched_tracks: 0.6
        track_title: 3.0
        track_artist: 2.0
        track_index: 1.0
        track_length: 2.0
        track_id: 5.0
        countries: []
        media: []
        original_year: no
    ignored: []
    track_length_grace: 10
    track_length_max: 30

        auto: yes.
        compare_threshold: 50


beet ls love 
beet ls -a forever [a for album]
beet stats
beet -c ~/beets/Paula_beets.yaml list format:'Windows Media'

There’s also an -f option (for format) that lets you specify what gets displayed in the results of a search:

beet ls -a forever -f '[$format] $album ($year) - $artist - $title [$format]'

Some nice commands

beet import -s    (run in singleton mode, tagging individual tracks instead of whole albums at a time)


While you import, use the "T" option to flip to Track mode from album mode. Makes a big difference!

To update your smart playlist:

beet splupdate


Kodi reads the album tags from the singletons in the non-album folder and creates a new album for each of these. So, you end up with an annoyingly large number of “single-song” albums in Kodi. Kodi suggests to remove album tags from these singles / singletons and then treats them as singles.

beet modify singleton:true album=

Give back to the community

Run these commands from time to time....

beet update
beet fingerprint
beet submit
beet -v absubmit [QUERY] 
beet mbsync [QUERY] 

During a long tagging import, it can be useful to keep track of albums that weren’t tagged successfully—either because they’re not in the MusicBrainz database or because something’s wrong with the files. Use the -l option to specify a filename to log every time you skip an album or import it “as-is” or an album gets skipped as a duplicate.

The -L (--library) flag is also useful for retagging. Instead of listing paths you want to import on the command line, specify a query string that matches items from your library. In this case, the -s (singleton) flag controls whether the query matches individual items or full albums. If you want to retag your whole library, just supply a null query, which matches everything: beet import -L


I had all funny erros like:

 File "/usr/lib/python2.7/dist-packages/OpenSSL/", line 947, in send
   raise TypeError("data must be a byte string")
TypeError: data must be a byte string

Upgrading these python packages did the trick

sudo easy_install --upgrade pip
sudo easy_install --upgrade cryptography
sudo easy_install --upgrade pyopenssl

I also had some issues doing the easy_install with cffi missing. I tried:

sudo apt-get install python-cffi

I needed to upgrade my setuptools

sudo pip install setuptools --upgrade

I had some issues with unrecognized file. I converted the mp3 to flac.

ffmpeg -i input.mp3 output.flac
ffmgeg -i -codec:a libmp3lame -qscale:a 2 input.mp3 output.mp3

Control quality with -qscale:a (or the alias -q:a). Values are encoder specific, so for libmp3lame the range is 0-9 where a lower value is a higher quality. 0-3 will normally produce transparent results, 4 (default) should be close to perceptual transparency, and 6 produces an "acceptable" quality. The option -qscale:a is mapped to the -V option in the standalone lame command-line interface tool.

LAME Bitrate Overview
lame option	Average kbit/s	Bitrate range kbit/s	ffmpeg option
-b 320	320	320 CBR (non VBR) example	-b:a 320k (NB this is 32KB/s, or its max)
-V 0	245	220-260	-q:a 0 (NB this is VBR from 22 to 26 KB/s)
-V 1	225	190-250	-q:a 1
-V 2	190	170-210	-q:a 2
-V 3	175	150-195	-q:a 3
-V 4	165	140-185	-q:a 4
-V 5	130	120-150	-q:a 5
-V 6	115	100-130	-q:a 6
-V 7	100	80-120	-q:a 7
-V 8	85	70-105	-q:a 8
-V 9	65	45-85	-q:a 9

In our example above, we selected -qscale:a 2, meaning we used LAME's option -V 2, which gives us a VBR MP3 audio stream with an average stereo bitrate of 170-210 kBit/s.

For batch processing files in folder:

for i in *.wav; do ffmpeg -i "$i" -f mp3 "${i%}.mp3"; done
for f in *.ac3 ; do ffmpeg -i "$f" -acodec libmp3lame -q:a 2 "${f%.*}.mp3"; done