You are not logged in.

#1 2017-11-26 07:46:59

cloverskull
Member
Registered: 2015-10-01
Posts: 348

Get that music collection under control with beets

Hey guys,

Preliminary note: these instructions have been tested on Debian Stretch, some steps may be slightly different on Jessie.

I just cobbled together notes from installing beets (was a bit nontrivial) and am going to throw the steps up here in case they're helpful for anyone else. That said, I write these things once in a while, does anyone read this stuff? tongue

I use mpd as my music daemon, and play music with ncmpcpp. I can't speak to how these steps may step all over your metadata configuration if you use other applications, so...good luck!

Let's install some prerequisites as well as beets itself.

sudo apt-get install beets imagemagick gstreamer1.0-plugins-base gstreamer1.0-plugins-bad gstreamer1.0-plugins-good gstreamer1.0-plugins-ugly gstreamer1.0-pulseaudio python-pip

Next, let's configure beets itself. Edit the config file by using

beet config -e

Paste the following into that file, but make sure to change your music directory.

# Beets configuration --------------------------------------------------------

directory: /home/ryan/Music/

import:
    # write metadata to music files
    write: yes

    # move imported files from source to the music directory
    move: yes
    copy: no
    delete: no

    # use auto-tagging where possible
    # do not require confirmation on strong matches
    autotag: yes
    timid: no

    resume: ask
    incremental: no
    none_rec_action: ask
    log:

    quiet: no  # enable with command line option
    quiet_fallback: skip
    default_action: apply

    singletons: no
    languages: []
    detail: no
    flat: no

# use the release-date of the original (first) release of an album?
original_date: no

# on multi-disk releases, assign track numbers for the whole album.
# If "per disk", make sure tracknames do not collide ("paths" setting).
per_disc_numbering: no

# files matching these patterns are deleted from source after import
clutter: ["Thumbs.DB", ".DS_Store", "*.m3u", ".pls", "*.jpg", "*.torrent"]

# files/directories matching one of these patterns are ignored during import
ignore: [".*", "*~", "System Volume Information"]


# Paths ----------------------------------------------------------------------

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

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

path_sep_replace: _

# filename for the album art
art_filename: cover  # results in "cover.jpg"

max_filename_length: 0  # unlimited


# General --------------------------------------------------------------------

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


# User Interface -------------------------------------------------------------

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

ui:
    terminal_width: 80
    length_diff_thresh: 10.0


# Auto Tagger ----------------------------------------------------------------

match:
    strong_rec_thresh: 0.1      # match 90% or better for auto import
    medium_rec_thresh: 0.25
    rec_gap_thresh: 0.25
    max_rec:
        missing_tracks: medium
        unmatched_tracks: medium
    distance_weights:
        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
    preferred:
        countries: []
        media: []
        original_year: no
    ignored: []
    track_length_grace: 10
    track_length_max: 30


# Plugins --------------------------------------------------------------------

plugins: [
    discogs,
    lyrics,
    #echonest,
    fetchart,
    embedart,
    lastgenre,
    scrub,
    mbsync,
    mpdupdate,
    #mpdstats,
    missing,
    duplicates
]
pluginpath: []


# Plugins Config -------------------------------------------------------------

lyrics:
    auto: yes
    fallback: ''

#echonest:
#    auto: yes

lastgenre:
    whitelist: ~/.config/beets/genres.txt
    canoncical: ~/.config/beets/genres-tree.yaml
    fallback: ''
    source: artist

fetchart:
    auto: yes
    maxwidth: 300
    cautious: true
    cover_names: cover folder

embedart:
    auto: yes
    maxwidth: 300

replaygain:
    backend: gstreamer
    auto: yes
    overwrite: yes
    albumgain: yes

scrub:
    auto: yes

# required for mpdstats
mpd:
    host: localhost
    port: 6600
    password:  # none

mpdstats:
    rating: False
    # two ratings are calculated:
    # "rolling" based on recent development
    # "stable" based on all-time development
    # rating mix 0.0 is all "rolling", 1.0 is all "stable"
    rating_mix: 0.75

missing:
    format: $albumartist - $album - $track - $title
    count: no
    total: no

duplicates:
    checksum: no  # expensive

Save, and exit. Now, we'll need a few plugins, which we'll install with pip.

pip install discogs-client
pip install pyechonest # I can't actually get this plugin to work, so it's commented out in the config file anyway

Now, let's try running beets and fix all of our metadata and tags on our music library.

beet import <path>

This is by no means comprehensive. The arch wiki has excellent beets docs, which I advise you to check out! My experience setting this up was not super simple and not very well documented in typical debian circles, hence my howto. Feedback welcome!

* edit - fixed arch wiki link - thanks @nore

Last edited by cloverskull (2017-11-26 18:56:37)

Offline

#2 2017-11-26 10:43:54

ohnonot
...again
Registered: 2015-09-29
Posts: 5,592

Re: Get that music collection under control with beets

cloverskull wrote:

That said, I write these things once in a while, does anyone read this stuff? tongue

when it concerns me.
this definitely concerns me.
beets' capabilities sound almost too good to be true.
if i may ask: would this also work as a music server? maybe even video, too???
since it has a web interface, i don't see why not...
if true, that would be the perfect combination of local & remote playback for me.
in addition to finally fixing those tags once and for all...
my jessie server has beets in the repos, version 1.3.8 - do you have any idea how good it is compared to the newer version you are writing about?

Offline

#3 2017-11-26 18:58:32

cloverskull
Member
Registered: 2015-10-01
Posts: 348

Re: Get that music collection under control with beets

I really am not sure about the difference in versions. And I think the version in Stretch may have a bug or two. It definitely fixed up my metadata and tags, and using ncmpcpp nowadays is a lot more consistent considering where all of my music has come from over the years.

For a music server, I know a lot of folks have used a web server with various remote control capabilities, auto-fetching of album art, stuff like that. I haven't delved into that but I may take a look smile

Offline

Board footer

Powered by FluxBB