# Aunique option does not consider catalognum

**URL:** <https://discourse.beets.io/t/aunique-option-does-not-consider-catalognum/1991>\
**Category:** Help\
**Created:** [January 17, 2022, 8:56am UTC](https://discourse.beets.io/t/aunique-option-does-not-consider-catalognum/1991 "2022-01-17T08:56:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cyan](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/cyan/32/615_2.png) [@cyan](https://discourse.beets.io/u/cyan)\
**Post date:** [January 17, 2022, 8:56am UTC](https://discourse.beets.io/t/aunique-option-does-not-consider-catalognum/1991/1 "2022-01-17T08:56:40Z")

</div>

Hello beets community,

I have a question about the `aunique` global option. I have configured it as folows, expanding the default keys by label, catalognum and year.

```auto
aunique:
    keys: label catalognum albumartist album year
    disambiguators: media albumtype albumdisambig releasegroupdisambig
    bracket: '[]'
paths:
  default: $label/%if{$catalognum,[$catalognum] }$albumartist - $album%aunique{}%if{$year, ($year)}/$disc-$track $artist - $title

```

My understanding is that beets will now consider two (or more) albums as duplicates when their labels, catalog numbers, albumartists, album and year match.

On import however beets fails to disambiguate these releases:

- [Hellfish – Untitled (2000, Vinyl) - Discogs](https://www.discogs.com/release/246775-Hellfish-Untitled)
- [Hellfish – Untitled (2011, Vinyl) - Discogs](https://www.discogs.com/release/3093031-Hellfish-Untitled)
- [Hellfish – Untitled (2015, Vinyl) - Discogs](https://www.discogs.com/release/7188736-Hellfish-Untitled)
- [Hellfish – Untitled (2015, Clear Transparent, Vinyl) - Discogs](https://www.discogs.com/release/7267662-Hellfish-Untitled)

beets warns me that this album is already in my library.

It seems as if beets will still use the default keys for the `aunique` option. I expect it however to realize that catalognumber or year or label are different for these releases.

I do not know where I made a mistake in my configuration. Could point me in the right direction please? Thank you so much!

---

<div class="post-metadata">

**Author:** ![adrian](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/adrian/32/4_2.png) [@adrian](https://discourse.beets.io/u/adrian)\
**Post date:** [January 17, 2022, 6:27pm UTC](https://discourse.beets.io/t/aunique-option-does-not-consider-catalognum/1991/2 "2022-01-17T18:27:19Z")

</div>

The `aunique` configuration does not affect duplicate detection; it only affects the `%aunique{}` template function. There is actually some recent (draft) work on making actual duplicate detection configurable:

> <https://github.com/beetbox/beets/pull/4199>
>
> \## Description
> 
> This adds an option \`duplicate\_keys\` which allows to configure… the behavior of the importer when it searches for duplicates.
> For example, one could add the \`format\` field so that the importer will always keep albums that have different formats.
> 
> Can you review this please? I still have to implement it for singletons.
> Also what do you think about allowing to use a Python function in \`duplicate\_action\` for full customization?
> 
> \## To Do
> 
> \- \[x\] Documentation
> \- \[x\] Changelog
> \- \[x\] Tests

It looks like that PR could use some collaboration and feedback, if you’re interested!

---

<div class="post-metadata">

**Author:** ![cyan](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/cyan/32/615_2.png) [@cyan](https://discourse.beets.io/u/cyan)\
**Post date:** [January 18, 2022, 12:39pm UTC](https://discourse.beets.io/t/aunique-option-does-not-consider-catalognum/1991/3 "2022-01-18T12:39:09Z")

</div>

Thank you for clarifying my misunderstandig. I will join the discussion at the pull request.
