Automatically merging two collections by file type

I have two sets of music files in my collection, one of FLACs and one of MP3s, and there are duplicates of many of the FLACs in the mp3s. I am combining the two by linking into a third directory and I can watch the import and hit S or R to deal with duplicate issues but is there a way of automating this within beets? I can presumably extend via scripting or a plugin but just wanted to check.

Interesting situation! What exactly would you want to automate? Skip all FLACs, and import all MP3s?

Depending on what “goal state” you want, you could consider using the duplicate_action config option creatively—perhaps in multiple passes—to make automated decisions.

The approach I have taken so far is to import the mp3 tree, then import the FLAC tree, and if an album exists as FLACs, remove old by hitting R manually, but it’s a very slow process. As the processing isn’t destructive I’m thinking about using expect to automate the keypresses, but I wanted to make sure I wasn’t missing anything in beets itself.

Ah, I see! If that’s the case, it seems like setting duplicate_action to remove would automate what you’ve been entering manually, right?

Makes sense, I’ll give it a try.

I want to do pretty much the same thing, and also want to prefer the FLACs. I had previously ripped my CDs as ogg, but am going back through as FLAC. So I could do the same thing and set the duplicate action to remove the old (changing how I operate the program to make the duplicate action options work for that I want), except in some cases, the ripper could not get a good FLAC for all tracks, so I would like to merge the albums, preferring the FLAC. Would it be possible to have duplicate action options based on size, bitrate, or other things? What does merge do with duplicate tracks?

Would it be possible to have duplicate action options based on size, bitrate, or other things?

That’s not currently possible; sorry!

What does merge do with duplicate tracks?

It enters the same interactive workflow for tagging a merged album as when you manually select the “merge” option.

Oh! I ASSumed it looked at the tags and would say “ok you just told me to use these tags, so I’ll add these tracks using the new tags, removing any tracks that would be duplicate, and leaving any tracks that aren’t in this new batch.” But now I looked at the resulting files and see that merge keeps the old and the new. Ok, I’ll have to plan better.

I completely forgot about this thread. In the end I did as Adrian suggested and did a couple of passes for each collection with duplicate_action set to remove and then manually imported albums it didn’t get matches for, usually when I looked for something and it wasn’t there.