Deleting duplicate songs on import

Hi folks,

Cross-posting here as groups seem less active: Google Groups

My setup is not too complex and have it mostly working except for one detail: duplicates are not getting merged. Current config: config.yaml. I’m looking to import folders that have incomplete albums that may combine to form one complete album e.g.

  • unsorted\A Perfect Circle\Mer de Noms (2000) P1
    • Contains tracks 1 through 6
  • unsorted\A Perfect Circle\Mer de Noms (2000) P2
    • Contains tracks 4 through 12

Using the attached config it correctly places all tracks in one folder but now getting duplicate tracks: “06 - 3 Libras.m4a” and “06 - 3 Libras.1.m4a”

What I want is for the highest match and/or highest bitrate file to remain (e.g. “06 - 3 Libras.m4a” in this case) and the other to be deleted from target directory. I thought that “merge: yes” along with “delete: yes” would accomplish this but apparently not. Any thoughts?

Thanks,

–Joel

Hello! merge: yes is part of the configuration for the duplicates plugin, which you need to run explicitly—it doesn’t happen automatically on import. Maybe give that a shot?

I also see that you have duplicate_action: merge. It might be worth temporarily removing both this and quiet: yes from your config to see what happens when you interactively decide to merge albums… and then compare the output (in verbose mode) with the automatic/quiet version.

Thanks @adrian! That’s exactly the direction I needed to figure this out. I’m now doing it in three steps with an updated config.yaml:

  1. beet %GLOBAL_SETTINGS% import -l %LOG% %UNSORTED_DIR%
    • Merges all files into %SORTED_DIR%
  2. beet %GLOBAL_SETTINGS% duplicates --delete
  3. beet %GLOBAL_SETTINGS% move -d %SORTED_DIR%
    • Needed to rename duplicate files since it adds ‘.1/2/3/etc.’ to the filenames

Unit tests are now all working and quite happy with this approach, but if someone sees something terribly wrong with this please let me know. :slight_smile: If I could avoid step#3 at the end that’d be great as I’m guessing that’ll take a while to do once I run this on my full library, but it’ll be done on my NAS so happy to let it run for a few days.

Cheers,
–Joel

1 Like