
Beets – Command-line music manager and auto-tagger - dewey
https://github.com/sampsyo/beets
======
dfc
I have no problem being the 15th person to say "Beets is awesome!" In addition
to the quality of the program sampsyo is a great maintainer. Quick to comment
on issues and is usually available on IRC. Beets + the archive.org API for the
Etree music collection would be awesome.

Tip: If you are about to import all of your music you and you have enough
space you can save some of the tedium by doing a quiet import initially:

    
    
      1. Optional: `$ cp -r ~/Music ~/ImportMusic ; mv ~/Music ~/Music.orig`
      2. enable whatever plugins you want (atleast: chroma fromfilename fetchart)
      3. Set up config
       
        directory: ~/Music
        import:
          move: yes
          quiet_fallback: skip
          log:    ~/.beets/imported-beets.log
    
      4. `$ beet import -q ~/ImportMusic`
    

This will take a little while depending on how big your collection is. When
that is finished the only things left in ImportMusic will be the things beets
need some help identifying. This part requires time and a little input from
you so plan on being near your $TERM

    
    
      5. `$ beet import ~/ImportMusic`
    

Keeping the backup copy of Music is probably not needed but I like to play it
safe.

 _tldr:_ No matter how you want to import do the quiet+skip import initially.

ADDENDUM: A similar program for pdf/epub/mobi --boox-- would be awesome. If
Calibre worked half as well and was developed by someone half as nice as
sampsyo the UI would almost be tolerable.

~~~
egeozcan
Responding to the addendum; does anyone know of a good "personal digital
asset/content management" tool to store and organize this data as well? There
is camlistore [0] but I think it's too low level for general use. Someone
needs to build something on top of it. I want the ultimate collection
management! =)

[0]: [https://camlistore.org/](https://camlistore.org/)

------
jitl
I use Beets to tag and organize all the music I and my roommmates download. We
feed just-completed media downloads into a version of FileBot[1]'s universal
media filer[2] that delegates music sorting to the beets executable. Beets
handles indexing music much more cleanly than the other solutions I tried,
especially in a shared server environment.

I've uploaded our media management scripts to GitHub here[3]. Note that there
is some minor rude language in a few scripts ;)

[1]: [http://www.filebot.net/](http://www.filebot.net/)

[2]:
[http://filebot.net/scripts/amc.groovy](http://filebot.net/scripts/amc.groovy)

[3]: [https://github.com/justjake/media-
tools](https://github.com/justjake/media-tools)

------
Wintamute
I would have been all over this if I hadn't of deleted my mp3 collection a few
years ago and now just use Spotify. I was pretty OCD in terms of managing my
mp3 collection, so dumping it all and using a streaming service is a welcome
life simplification.

~~~
fletchowns
Music is way too important in my life to temporarily rent it from some company
that may or may not be around or even have the same content available in a few
years.

~~~
rtpg
Google Music has an "upload your own music" feature (up to 10k songs free!
That's 500 CDs and for anyone who isn't in the music making profession I can't
imagine needing more). It ends up being a sort of dropbox-like mechanism (you
can download as many times to your phone, only 3 times to your computer
though).

In case of failure of Google I still have a decent amount of music on my phone
and I do have the stuff on my phone. In the (much more) likely case of drive
failure I can get my music again (I could even circumvent the download limit
through a Google->phone->PC thing but that would be a pain).

I think it's important not to overestimate your personal capacity to not lose
things compared to companies like Google (especially considering that I am not
aware of many companies that fell off the face of the earth in less than 24
hours for you to lose all your data)

edit: google music player on android is pretty annoying though (just slightly
better than the stock player from old android). The fact that you need a data
connection to play a random mix of your music startles me.

~~~
dfc
The minute Google converts one of my flacs to 320kbps mp3s the file is lost. I
don't want to circumvent anything in order to have access to my data. Why does
it startle you? When you don't pay for something you are the product. I would
be more surprised if google gave you all this great music and did not expect
anything in return.

~~~
rtpg
>The minute Google converts one of my flacs to 320kbps mp3s the file is lost.
Only lost if the file is lost on your end too.

>I don't want to circumvent anything in order to have access to my data.

If you're an audiophile/actually doing things with the raw files, then this is
not for you, but for most people (read: 99% of people) the diff between
320kbps mp3 and flacs is not there.

> Why does it startle you? When you don't pay for something you are the
> product. I would be more surprised if google gave you all this great music
> and did not expect anything in return.

Sure, I don't care about sending my music usage stats(hell I already do it
publicly with last.fm) but at least have an _option_ when my data connection
is down.

~~~
frobozz
The difference will exist at some point in the future when I want to convert
those flacs/mp3s to a new lossy format for some reason (e.g. when the only
place you can buy an mp3 player is in an antique shop). Then when my great
grandson wants to listen to my music, and you can't even buy a player for
whatever that format was.

------
mattl
I wrote up a little guide on this a while back --
[http://lttam.wordpress.com/2012/01/31/beets-and-an-
unwaverin...](http://lttam.wordpress.com/2012/01/31/beets-and-an-unwavering-
band-of-light/)

------
jzelinskie
I've been tempted to try tools like these throughout the years, but honestly
I've come to learn that nothing is black and white about tagging. I usually
use the "Album Artist" field to organize music into logical collections that I
want. If I took everything literally, I'd have to deal digging through
"Various Artists" and other disagreements I have with established music
databases.

~~~
dfc
It is important to note that beets _never_ forces you to use default format.
If you want it to use your metadata you can tell beets to import it as is.
More importantly there are two plugins that look perfect for you: (in order of
effort)

 _Rewrite Plugin:_ The rewrite plugin lets you easily substitute values in
your templates and path formats. Specifically, it is intended to let you
canonicalize names such as artists: for example, perhaps you want albums from
The Jimi Hendrix Experience to be sorted into the same folder as solo Hendrix
albums.[^1]

 _Inline Plugin:_ The inline plugin lets you use Python to customize your path
formats. Using it, you can define template fields in your beets configuration
file and refer to them from your template strings in the paths: section of the
configuration file.[^2]

[^1]:
[https://beets.readthedocs.org/en/v1.3.3/plugins/rewrite.html](https://beets.readthedocs.org/en/v1.3.3/plugins/rewrite.html)

[^2]:
[https://beets.readthedocs.org/en/v1.3.3/plugins/inline.html](https://beets.readthedocs.org/en/v1.3.3/plugins/inline.html)

~~~
maxerickson
It's more important to note that you can tell it to not move files and to not
edit the metadata stored in files.

This makes it useful for playback and finding information without first having
to trust it.

------
fortes
Beets is fantastic, really automates a ton of really annoying work. The author
is pretty responsive with issues, and there's a growing community of
contributors.

Feel free to crib off of my config file:
[https://github.com/fortes/dotfiles/blob/master/.config/beets...](https://github.com/fortes/dotfiles/blob/master/.config/beets/config.yaml)

------
res0nat0r
Beets is awesome. It also supports acoustic fingerprinting, so you can pass it
songs without any id3 tags at all and it will try and guess the song is.

------
daturkel
There is also an extensive ongoing thread about Beets in the what.cd (music
torrent tracker) forum, where the creator posted about it:
[https://what.cd/forums.php?action=viewthread&threadid=97720](https://what.cd/forums.php?action=viewthread&threadid=97720)

edit: available only to members, unfortunately

~~~
Matsta
I love what.cd but the problem is their tracker has been non stopped ddos'd
for the last few weeks that it's almost impossible to download anything.

~~~
daturkel
Yeah this is definitely unfortunate. The forums remain high-quality in the
meantime.

------
aidos
This is great. It looks like just the tool I need to try to beat my broken
iTunes collection back into shape - it was once perfect, but a burglary of my
machine and backup drive (same location, stupid me) meant I had to scrabble
together a messy version from various backups etc. iTunes is unusable for me
due to the collection size so I mostly just use spotify instead of fighting
with it.

I tried a test on a single artist tonight (2pac) but ran into a bit of a
roadblock. There's no 'merge' function. So if you have an incomplete album in
the library and you import a directory that contains the rest of the tracks,
your choices are to delete the incomplete one or to put the new tracks into
their own album. This might sound like an edge case but if you have an album
that's currently in 2 directories (cd1 and cd2) then you're fairly well
screwed.

~~~
dfc
You need to give it a little more time. It does not sound like you have spent
much time looking through the documentation. Dont forget to check out the open
and closed issues for your hiccups. Its worth pointing out that its not a mind
reader, you do have to put in a little effort for corner cases.

I am not 100% sure what you mean about merge. You can just `cp LATEADDITIONS
Music/artist/ablum` and then "reimport the album" with `beet import
Music/Artist/Album`.

As far as cd1/cd2 goes you are only "fairly well screwed" if you can not type
`$ mv cd1/* cd2 ; beet import cd2`. I think there is another way to do this
but I am not a beets guru. I seem to recall there is a discussion of this in
one of the issues on github. But lets face it `mv CD1/* CD2/ ; beet import
CD2` is not that difficult.

If you have a big directory full of unsorted albums there is also this new
gem:

    
    
       The importer has a new interactive option (*G* for "Group albums"),
        command-line flag (``--group-albums``), and config option
        (:ref:`group_albums`) that lets you split apart albums that are mixed
        together in a single directory. Thanks to geigerzaehler.

~~~
aidos
I'm going to give it more time, I didn't mean to sound like I was giving up. I
spent the last hour reading through the importer code to see how it might
handle this case but there's really no way of doing it in the tool (there's an
open issue for it [0] [1]).

I used "fairly well screwed" in the context of trying to automate the cleanup
of 60,000+ songs. One album isn't an issue - 10,000 or so where you need to
keep dipping in and out of the tool to manually move stuff around isn't really
ideal.

Just to confirm, since you seem to have some experience - you can reimport an
album to clean it up again (say after adding additional files) by calling
import on a path in your library? So it's ok to mess with the files in the
library and then fix the db later by importing? From what I saw in the code I
didn't see anything that would handle removing / moving files, do you know if
it handles those cases?

Again, my language was probably a little strong, and mostly only applies to
the more extreme situation I'm in.

ps your other comment about doing the import in 2 steps seems like a bit of a
life saving hint. Will definitely go that way when / if I commit to this.

[0]
[https://code.google.com/p/beets/issues/detail?id=380](https://code.google.com/p/beets/issues/detail?id=380)

[1]
[https://github.com/sampsyo/beets/issues/112](https://github.com/sampsyo/beets/issues/112)

~~~
dfc
The beets reimport functionality should really be thought of as a sanity check
/ rescan / quality control. So it will recognize the "untracked files" to
borrow some git terminology. That is for adding files. As far as removing,
moving, modifying files (i am assuming you mean metadata?) goes take a look at
the move/remove/update beet commands.

What follows is a slightly rambly not well edited description of my importing.
I apologize for the length/grammar.

I think I was in a similar situation as you. I started with 5 or 6 big
collections of music that had diverged over the years; flac/shn bootlegs, old
itunes installations, xmms libraries, etc and a couple of small collections
from netbooks:

    
    
      /music/itunes
      /music/olditunes
      /music/olditunes-ibookg3
      /music/current
      /music/blah
      ...
    
    
    

Before touching beets I ran rdfind over the itunes directories and then over
the non itunes directories. rdfind leaves the copy in the directory listed
earliest so I listed the directories in order of most recently used. This
essentially wiped out the oldest directory from the itunes and non-itunes
sets. I then ran rdfind against all of the directories (once again in order of
most recently used). The amount of space I saved was insane.

Once I had manually cleaned up the low hanging duplicate fruit I did the two
step import. I got hit with the CD1/CD2 quirk the first time I did the two
step import. Because I had the backup directory I just blew away the beet
library and started over. This time before I ran the quiet import I tried to
do a best effort of consolidating the cd1/2 albums. `tree` came in handy for
finding the problem albums:

    
    
      $ tree -i -f -d --prune /music |grep -i "cd1\|disc1\|cd\ 1\|disc\ 1""
    

I did the `mv cd1/* cd2/` by hand. It did not take as long as I thought it
would. I gave it my best effort and reran the quiet import. This solved a ton
of the problems. Before doing the interactive import I sorted /music with

    
    
      $ du --max-depth=3 -h /music |sort -h 
    

Because I used the move import instead of copying it was easy to see if there
were any recurring problems. The only things that are left are the things
beets could not ID by itself. My biggest import hiccup was concerts from
archive.org's etree archive. I still have to move them in. I am still deciding
how I want to handle the one hit wonder songs. Right now my config has the
following for paths:

    
    
      paths:
          default: $albumartist/$album%aunique{}/$track $title
          singleton: 0xSingles/$genre/$artist/$title
          comp: 0xCompilations/$genre/$album%aunique{}/$track $title
    

The singleton and compilation defaults are:

    
    
        singleton: Non-Album/$artist/$title
        comp: Compilations/$album%aunique{}/$track $title
    

This was going to mean my non-album and compilation album directories had
hundreds of directories.

Feel free to followup with any more questions.

~~~
dfc
ARGH! I just saw this on the man page:

    
    
      If you have an album that's split across several directories under a common
      top directory, use the --flat option.  This takes all the music files under the
      directory (recursively) and treats them as a single large album instead of as
      one album per directory. This can help with your more stubborn multi-disc albums.
    

That might be easier than doing all the mv cd1 cd2. I have never used it. It
will increase the interactivity of the import.

------
digitalsushi
I dont really count myself as a real developer, but I released a little thing
I have been using on github last week: [https://github.com/digitalsushi/osx-
filesystem-tags-music-pl...](https://github.com/digitalsushi/osx-filesystem-
tags-music-playlist)

I am using the OS X 10.9 filesystem tags as playlist markers for my music -
dirs or individual songs. I can just run my script and it will create m3u
playlists off of all the tags I have applied.

I really wish these tags worked in linux. I'm obviously on a mac, and it hurts
my heart I can't use it 'where I come from'. Cause I find it ridiculously
simple/useful.

~~~
bonkabonka
Most often these days, distros ship with filesystem extended attributes
enabled (though you might have to add the user_xattr flag to the mount options
to be able to actually use them).

------
ihuman
Why should I use this, as opposed to something like mpd and ncmpcpp?

~~~
frewsxcv
They're entirely different. mpd is an audio daemon that plays audio. Beets is
a tool for organizing/tagging your audio files. There's a plugin for Beets
called 'bpd' that acts like an mpd server on top of your beets audio library

------
wernerb
Thanks for the tip guys! One thing I found annoying was that it could not add
replaygain for flac. To get around this, install metaflac and execute the
following:

    
    
        find somealbum-with-cds -type f -name "*.flac" -print0 | xargs -0 metaflac --add-replay-gain
    

Then import as normal and it will have replaygain included (and store the
replaygain in the library).

------
mayneack
I see that they are plugged into musicbrainz[1]. Other than being a CLI, has
anyone used this and picard[2]? What's the difference? I've used picard a lot.

[1] [http://musicbrainz.org](http://musicbrainz.org)

[2]
[http://musicbrainz.org/doc/MusicBrainz_Picard](http://musicbrainz.org/doc/MusicBrainz_Picard)

~~~
siddboots
I used to use Picard as "pre-processing" step. I ran any new music through it
before I added it to my music player's library. You can use beets in exactly
the same way if you want, and it would be a like-for-like CLI replacement.

The key difference that Beets brings is to unify the concept of a tagger with
the concept of a music library, which made a lot of sense in my mind.

In other words, Beets maintains a persistent database of your music
collection, which can be kept in sync with Musicbrainz. You can query the
database from the command line to get a list of files, and then pipe that list
into a music player of choice, or just query the database from a script or
web-app and build your own lightweight music player.

------
bjackman
Cool - I'll set this up tomorrow, it looks good and my Music library is a
mess.

It would be nice to have a centralised repository on the website where people
can share plugins (like Sublime's Package Control, which is 3rd party).
Programmable is great, but it would be a shame if everyone had their own half-
arsed solutions to common problems.

~~~
dewey
Not exactly what you are asking for but there's a section about available
plugins on the website [0] and I guess you could submit your own plugins with
a pull request [1].

[0]
[http://beets.readthedocs.org/en/v1.3.3/plugins/index.html](http://beets.readthedocs.org/en/v1.3.3/plugins/index.html)

[1]
[https://github.com/sampsyo/beets/blob/v1.3.3/docs/plugins/in...](https://github.com/sampsyo/beets/blob/v1.3.3/docs/plugins/index.rst)

------
noisy_boy
I can't find the config to make in-place auto-tagging and renaming for
singletons. At the moment I'm setting move: yes, singleton: <path to some temp
directory>, running an import with -s and then manually move the renamed
tracks back to the original directory. Is there a simpler way?

------
NoahTheDuke
This looks like a pretty sweet non-Windows solution to the lack of foobar2k.
As I'm currently using Windows, though, I can't see myself changing over.
Foobar2k is just too good.

Anyone else have experience with both, and would like to share their
experiences?

~~~
nettletea
It's a CLI python app, so I'd have though that it was Windows friendly.

I spent days trying to organise my collection of music (and still haven't
suceeded). It's in many formats. In the past I've stripped metadata and just
relied on file names, and file structure. I've later re-added it, due to
helping playback on some devices. Tagging generally annoys me, and doesn't
bring me much. The thing I'd quite like is sleeve notes, and good track info,
who wrote the song, which artists played on it etc.

Anyway I have tried a mix of quodlibet/exfalso (with plugins), foobar2k(with
wine), mp3tag, and shell scripts. Then I discovered beets, and thought wow
that's great. Only to later forget about the application and return to the
laborious task of sorting out my files. I rediscovered beets and tested it on
a directory of music and was pretty impressed with the ease of it all and the
results. Far easier than attempting it by hand.

Having said that the bit that takes me the longest is gathering up and
organising orphans. If they are albums, I have to get them into order, then
try and locate the tags. Or pepper the files with enough clues, for a tagger.
It's all a bit of a yawn fest.

Which reminds me, I bothered to apply replay gain to most of my albums with
foobar2k but that sometimes results with very quiet playback on some albums on
one of my players at least. I then curse profusely, and just want to rip all
of the metadata back out, or even just throw the lot away...

------
johnward
Anyone know how I can install this without PIP? I just spent time getting rid
of the multiple package managers I had because they were causing conflicts.
Now I only use homebrew and have no interested in adding more.

~~~
dewey
[http://beets.readthedocs.org/en/v1.3.3/guides/main.html](http://beets.readthedocs.org/en/v1.3.3/guides/main.html)

"To install without pip, download beets from its PyPI page and run python
setup.py install in the directory therein." \-
[https://pypi.python.org/pypi/beets#downloads](https://pypi.python.org/pypi/beets#downloads)

~~~
johnward
Thanks. I made the mistake of assuming that the git read me "pip install
beets" was an requirement because it said install and then read this.

"You can install beets by typing pip install beets. Then check out the Getting
Started guide."

------
chacham15
This looks awesome, and I've been wanting a library like this for some time.
Only thing is that I'd need a C/C++ version. Is there one out there like that?

~~~
hartror
Curious why you need a C/C++ version?

~~~
chacham15
I want to integrate it with a fuse filesystem

~~~
samps
Someone has done this for beets some time ago already:
[https://code.google.com/p/beetfs/](https://code.google.com/p/beetfs/)

But it has bitrotted pretty badly.

------
jonalmeida
FYI, a neat existing command-line music player that's already on debian
repositories (and I'm guessing others as well) is called `mocp`.

~~~
dfc
beets is also in Debian:
[https://packages.debian.org/sid/beets](https://packages.debian.org/sid/beets)

~~~
voltagex_
I'm wondering if it's valid to file a bug that Debian's source for beets is in
SVN whereas beets moved to Git, and could be handled with git-buildpackage
now.

~~~
dfc
That is just for the ./debian/ package directory. I think it is up to the DD
how they want to maintain the packaging files. The BPP[1] do not mention
anything about matching uptreams choice of vcs.

You could file asking to package the latest upstream and casually mention the
discrepancy:) I have just been building beets with uupdate lately. Debian's
package is five months behind upstream.

[1] [https://www.debian.org/doc/manuals/developers-
reference/best...](https://www.debian.org/doc/manuals/developers-
reference/best-pkging-practices.html#bpp-vcs)

------
andrewflnr
This sounds like one of those wonderful programs I only wish I had the
wherewithal to write. Hopefully I'll get to try it this weekend.

------
jdangu
Would be perfect for my raspberry pi. Anyone tested?

~~~
weavie
I was going to ask the same thing. The pi really struggles with XBMC to the
point where I've given up on it. A command line version I can control via ssh
is just what it needs.

It says you need an html5 browser to play your music. Is there a plugin that
can just play the music directly, so I can play via ssh and not have to kick
off vnc?

~~~
apag
Why would you need VNC?

You only need a browser. On the machine on which you thought you were going to
run the VNC client, you open the browser and go to beets’s web UI. Then you
pick some music to play, and beets streams it to the browser, which plays it
on that machine.

If you actually want the Pi itself to be playing music, then you probably want
not the beets web plugin but the BPD plugin, which emulates an MPD server. You
can use any MPD client you want to control it – CLI on the Pi, one of the GUI
apps over the network, whatever.

No matter what, VNC doesn’t enter the picture.

------
ndrake
Will it play nice with my iTunes library?

~~~
kraymer
I use beets as an importer (filename + id3 tags cleaning) and keep using
iTunes for browsing/playing. I glue the two together by using importfeeds
plugin +
Hazel([http://www.noodlesoft.com/hazel](http://www.noodlesoft.com/hazel)) to
trigger iTunes import. Should probably blog about my setup as it's not the
simplest one but works great.

~~~
shawnj
I'd love to see a blog about that!

------
heywire
Kind of off topic, but pianobar is a great commandline Pandora client, if
you're into that sort of thing.

------
fournm
Ooh, this looks exactly like what I was looking for like ... a year and a half
ago to go along with dmpc.

------
jaseemabid
I've been using it for a year or so. Yet another happy customer and would
totally recommend it.

------
nilved
I've used beets for all my music for like a year and half. It's stellar. Use
it.

------
monkeynotes
If only I had known about this before I moved all my music storage to iTunes
Match.

~~~
r00fus
Doesn't iTunes match support adding new content into iTunes (i.e., to be
matched)?

Why would there be an issue here?

~~~
cobralibre
The issue, I assume, is that the parent poster would have liked to use beets
on his or her existing music collection but now cannot because it's no longer
local.

------
daurnimator
ah; nice.

A long time ago I was working on something similar:
[http://daurnimator.github.io/lomp2/](http://daurnimator.github.io/lomp2/)

Got pushed to the side due to study; then work :(

------
poolpool
Am I missing something or is the "web" command non existent?

~~~
nilved
What would that command do?

~~~
dewey
It's showing in the (old) demo video [0] and makes it possible to query the
database through a web interface. Maybe the web interface isn't enabled by
default, add the plugin [1] to enable it.

[0] [http://beets.radbox.org/](http://beets.radbox.org/)

[1]
[http://beets.readthedocs.org/en/v1.3.3/plugins/web.html](http://beets.readthedocs.org/en/v1.3.3/plugins/web.html)

------
halfoot
I have been using this for a few months now. great work.

------
smgoller
Does this deal with FLAC album images properly?

~~~
samps
Yep. :)

~~~
smgoller
Crap. I just realized what I said was completely ambiguous. What I meant was,
does it deal with FLAC images of albums? (whole album stored in a single file
with cuesheet.)

------
encoderer
Beats Music sends C&D in 3...2...

~~~
glomph
Beets predates beats. Not sure that matters though.

------
kurtschwanda
Nobody likes beets, Dwight.

