Keeping source/original folder name

I know this probably isn’t the primary usage for beets, but I’m trying to re-organize my music collection. I got beets setup and it’s pretty awesome, but one of the major things I want, that hasn’t happened and I would love to automate, is moving all of the albums from one big folder (like I have now) into something like:

Root
–Artist
–Album
–Album
–Album
–Album

This is easily done, but what I want is to keep the original folder naming convention for the Album section, so like the following:

Limp_Bizkit-Chocolate_Starfish_and_the_Hot_Dog_Flavored_Water-2000-OFFY
Queen_Boxed_Set-2000-OFFY
Slipknot-Disasterpieces-2002-OFFY
VA-Godzilla_OST-1998-OFFY
VA-Rock_Sound_Vol.42-2001-OFFY

How can I keep all of that info? I thus far can get AlbumArtist-Album-Year but that’s about it.

Interesting! The beets philosophy is that you should be able to generate the filenames for everything based on information in the database. So it can help to start by thinking about what rules define your filenames. For example:

  • $albumartist-$album-$year. That’s easy enough to do with the beets paths configuration.
  • Use underscores in place of spaces. You can do that with the replace config option.
  • An extra suffix: what’s going on there? Is it always OFFY, or does it mean something? You could create an attribute for storing this piece of information and then include it in your template.

The suffix is usually the group that released it, in this case I ripped those CDs myself and tagged them as such.

Cool! Then I’d suggest you use a new field, called releaser or something, and put the data there. You can use beet modify -a releaser=foo some_album to do that, and then include $releaser in your path format template.

You could even imagine automating that with a little scripting effort.

Hey Adrian, where exactly would I add the new field? I’ve been banging my head against a wall. Basically, is it possible to ELI5 for someone who’s not versed in how this thing actually works?

Separately, is it possible to call beets from an external python source?

There’s actually nothing to do to “add” a new field—just start using it! Using the modify command I gave above should be all you need to do.

Oh, well I feel dumb. I’ll try it out when I get back home. What about the other question regarding external python sources? Is that doable?

Oh right—yes, it is possible to import beets from another Python program and do some work there. It does require a few tricks, however, to set up a Library object and run queries against it. There are a few other threads about this topic on this Discourse and in GitHub issues—it might be possible to find some good hints by searching for things like “beets as a Python library.”

So just to follow up on this, it looks like the “foo” part is static, which is where you were referring to scripting it to automate it, since I’ve got ~300 groups I’d like to keep, right?

Yep, that’s exactly it.