Separating same album with different codec/bitdepth/bitrate

Let me first apologize because I’m a total newbie with Beets and still discovering all it’s possibilities. And my first impressions are that they are vast and incredible. Really hyped about it. So thanks a lot for developing Beets!

I’m trying to find out how I could work with multiple versions of the same album with different codec/bitdepth/bitrates.

Let me take my Paul Simon folder as an example. With the default Config file I get the results on the right of the screenshot. I chose of course to ‘Keep’ versions and I’m trying to find out a solution to do this more precise.
(Question continues below screenshot)

Let me start with the more easy part I guess.
For the album ‘Stranger to Stranger’ I have multiple versions:

  • FLAC 16/44
  • FLAC 24/96
  • MP3 320

Is there a way to keep those specific codec/bitdepth/bitrate versions in their own respective folder with a visual clue as to which codec/bitdepth/bitrate version it is whilst auto-tagging them with Beets and copying them to a new music directory? Currently I’ve used ‘Keep’ but then the [xx] gets added because it’s essentially the same album. How do others do this?

Another more challenging question I guess is how you go about ‘remastered’ version, deluxe versions with bonus tracks etc, combined with the codec/bitdepth/bitrate challenge mentioned earlier.

  • Which plugin (if any) would be able to differentiate between a regular and remastered release?
  • Is there a way to add those special release information like (remastered and bonus) to the name of the album folder? And how?

The essence is that I would like to be able to keep different versions and being able to differentiate visually between these versions while having Beets also tag and rename files properly where necessary.

I do realize that adding extra information to Album titles doesn’t really please the eyes so I’m also welcoming suggestion how to go about this in different ways.

Thanks for any ideas, and sorry if this warrants a RTFM.

Jan

Hi! I’m glad beets is going well for you so far!

  • For distinguishing between different releases of the same album: MusicBrainz actually has this data! Take a look at the $albumdisambig field if you’ve tagged from MB; it often contains something like “1999 remaster” or “deluxe edition.”
  • For separating albums based on format, you’ll likely want to use the inline plugin to define an album-level field based on the track-level $format field. Here’s one user’s implementation, for example.

Thanks @adrian for your swift response,
I’m going to experiment with this over the weekend.

If anyone has a working config file for this (or part of a config file) that can achieve this, please share. So I can study it to better understand it.

Thanks, Jan

One problem I had was I wanted beets to keep the duplicate check logic, but only within a given format family. In the end, I found I had to use multiple beets libraries to accomplish what I wanted. It’s not super difficult, I just added the following aliases to my .bashrc:

alias fbeet='beet -l ~/.config/beets/flac.blb'
alias mbeet='beet -l ~/.config/beets/mp3.blb'

As for keeping everything organized, here’s my path configuration:

paths:
  # Albums/A/ASCI Artist Name, The/[YEAR] ASCI Album Name, The [EP]/01 - Track Name.mp3
  default: '$format/Albums/%bucket{%upper{%left{%the{$albumartist},1}}}/%the{$albumartist}/[%if{$original_year,$original_year,0000}] $album %aunique{albumartist album year, albumtype label catalognum albumdisambig}/%if{$multidisc,$disc-}$track - $title'
  # Singles/ASCII Artist Name, The - Track Name.mp3
  singleton: '$format/Singles/%%the{$artist} - $title'
  # Compilations/[YEAR] ASCI Compilation Name, The/01-01 - Track Name.mp3
  comp: '$format/Compilations/[%if{$original_year,$original_year,0000}] %the{$album%if{%aunique, %aunique{albumartist album year, albumtype label catalognum albumdisambig}}}/%if{$multidisc,$disc-}$track - $title'
  # Sountracks/[YEAR] ASCI Soundtrack Name, The/01 - Track Name.mp3
  albumtype:soundtrack: '$format/Soundtracks/[%if{$original_year,$original_year,0000}] %the{$album%if{%aunique, %aunique{albumartist album year, albumtype label catalognum albumdisambig}}}/%if{$multidisc,$disk-}$track - $title'
  # Artifacts
  ext:cue: '$albumpath/$album'
  ext:CUE: '$albumpath/$album'
  ext:log: '$albumpath/$album'
  ext:LOG: '$albumpath/$album'
  ext:m3u: '$albumpath/$album'
  ext:m3u8: '$albumpath/$album'
  ext:pls: '$albumpath/$album'
  ext:nfo: '$albumpath/$album'
  ext:sfv: '$albumpath/$album'
  ext:ffp: '$albumpath/$album'
  ext:accurip: '$albumpath/$album'

# Inline plugin multidisc template
item_fields:
  multidisc: 1 if disctotal > 1 else 0

There’s a lot happening there, but if you focus on the default path we can break down how I used the format and disambiguation:

  # Albums/A/ASCI Artist Name, The/[YEAR] ASCI Album Name, The [EP]/01 - Track Name.mp3
 default: '$format/Albums/%bucket{%upper{%left{%the{$albumartist},1}}}/%the{$albumartist}/[%if{$original_year,$original_year,0000}] $album %aunique{albumartist album year, albumtype label catalognum albumdisambig}/%if{$multidisc,$disc-}$track - $title'

Right away I split the path based on the $format. I only care about MP3 vs FLAC, so this is good enough. If you want to identify bitrates, you may need the inline plugin solution described by @adrian and then you can reference that. There’s some stuff album type and the bucket plugin, and then I put the year before the album, so that artist directories are sorted chronologically based on original release date. Finally, there’s the album name, and a disambiguation field if it’s a duplicate - you can see that I specify the order of fields to use for disambiguation. Finally, I use my own item level inline, multidisc, to keep multi-disk albums sorted corrected within a single folder.

You could move the $format to somewhere else in the path if you wanted different formats to be in the same parent folder. As long as it’s in the folder path somewhere the two beets libraries shouldn’t conflict. If the format is in the filename though, the other file types (nfo, cue, log, etc) might clobber each other.

Hi Mike (@macleodmike),

Thanks for your extensive post. Higher Beets-science I must say but I’m understanding it more and more :wink: I’m going to research and experiment with what you’ve written and I might revisit you for some further clarification if you don’t mind.

One first question is why you wanted to keep the duplicate logic for mp3 and flac separately? What is the benefit for you?

Thanks, Jan

I wanted beets to identify if I was attempting to import a second copy of an album, and use the regular selection logic or prompt, but only within each format family. Sometimes I want to replace, other times I want to keep both, etc. In order to have both FLAC and MP3 copies of albums in a single library I had to disable the duplicate check in the config.yaml, and I found that resulted in… unwanted duplicates.

1 Like

Hi @macleodmike and @adrian (and other too ;-))

I’ve come a long way over the weekend.
My Paul Simon folder now looks like this (before and after)

when I do a test run with the following Path:

default: 'Albums/%the{$albumartist}/$album %aunique{albumartist album year, albumtype label catalognum albumdisambig}%if{$albumdisambig,($albumdisambig$, $year) }(%if{$original_year,$original_year}) ($format $bitdepth-$samplerate)/%if{$multidisc,$disc-}$track - $title'

This is getting to what I would like achieve so going well.
But there are a few remaining questions which I hope you (or others) have some ideas on:

  • I’ve not found a way to let beets now that if I import a duplicate album but with a other samplerate (a field that would differentiate the various FLAC resolutions) it should not be marked as a duplicate. Is something like that possible?

  • I trying to understand the [xx] (e.g. 18, 19 etc) field. It looks like a marker for duplicates but both albums like ‘So beautiful so what’ and ‘Songs from the Capeman’ have it while only one is a true duplicate. So I might have a wrong field in my path. Does anyone know what I’m doing wrong? Also if I can find a way to solve the previous question this one might go away.

  • Is there a way to add sections in a path based on criteria so that I can add different fields for MP3 and FLAC? Because MP3’s don’t have a bitdepth field and samplerate is mostly 44 so I would like to define MP3’s in the path with ($format $albumbitrate) (via the inline plugin) and FLACs with ($format $bitdepth-@samplerate). It would ask for some conditional like %if FLAC and %if MP3 I guess but I’ve not found a way to do this.

  • And is there a way to prevent extra spaces that sometimes occur when a field is not available?

  • @macleodmike you write “you can see that I specify the order of fields to use for disambiguation” and you place the aunique fields in the path and not in the config itself. I copied your path and adapted it and in my config (still a lot like the default) I also have a section:

    aunique:
    keys: albumartist album
    disambiguators: albumtype year label catalognum albumdisambig releasegroupdisambig
    bracket: ‘()’

How does this relate to how you use it? Is it a duplication or have both their use?
Do you know of a way to disambiguate albums that are remastered since MusicBrainz often doesn’t show me remastered values for dismbiguation.

I have more questions but they are of a more general nature so I’ll post them as separate posts, might be easier for future reference to other users.

Thanks a lot for your help so far. It has been invaluable,

Jan

Not currently; sorry!

That comes from %aunique{}, which is a complicated topic in itself, but it emits those numbers as a “last resort” if its disambiguators fail to distinguish between the two albums. You may want to add stuff like samplerate to your %aunique{} call to tell the system that your path already includes this information.

You might consider using query-conditioned path formats, like the albumtype:soundtrack example discussed in the docs. Or combine the inline plugin with %if{} as described in this FAQ about disc folders.

Thanks for the suggestions @adrian, looks great. I’m going to try these out and report back.

This is precisely why I ended up using multiple beets libraries - one for each category in which I still wanted duplicate logic. I don’t do 24/96 FLAC, so I only had two to worry about: MP3 and FLAC. Sounds like you want one for MP3 and then a separate one for each FLAC bitdepth/samplerate combo.

Thanks for your replies @adrian and @macleodmike. I’ve decided that it’s unnecessary to keep duplicate lower bitdepth/samplerate FLACs or MP3 versions of the same album when a better version trumps them. Cleans up my collection quite a bit. So multiple beets libraries won’t be necessary anymore.

Let me first say @adrian that I’m afraid what I want to achieve is getting a bit above my comprehension level. So any further help is really appreciated but feel free to let me know if my questions take too much of your time. Then I rest my search and consider dropping my naming scheme for something more doable.

Regarding the different formatting of FLAC and MP3 paths

Using the inline plugin looks like a sound idea. Since I’ve already got the following in my inline settings to print the format in my folder names

# Inline plugin template
item_fields:
  multidisc: 1 if disctotal > 1 else 
  my_samplerate: samplerate / 1000
album_fields:  
  format: |
       formatList = []
       for item in items:
           formatList.append(item.format)
       return formatList

I thought I could reference the output something like this, where the first statement determines if it is a FLAC second and third statement are path formats for if FLAC is true and for when it’s another format.

%if{$format:"FLAC",($format $bitdepth-$samplerate),($format $bitrate)}

But that didn’t do a thing :frowning: I’m sure it’s my knowledge lacking, but after reading through the FAQs and manual I still haven’t figured out what I’m doing wrong. Any further suggestions are most welcome.

Thanks again,
Jan

Read about solutions here:
https://discourse.beets.io/t/different-path-formatting-for-flac-and-mp3-aac-with-if-and-inline-plugin

1 Like