# Disambiguation issues (with Weezer, specifically)

**URL:** <https://discourse.beets.io/t/disambiguation-issues-with-weezer-specifically/29>\
**Category:** Help\
**Created:** [January 24, 2017, 6:49pm UTC](https://discourse.beets.io/t/disambiguation-issues-with-weezer-specifically/29 "2017-01-24T18:49:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![duckpuppy](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/duckpuppy/32/13_2.png) [@duckpuppy](https://discourse.beets.io/u/duckpuppy)\
**Post date:** [January 24, 2017, 6:49pm UTC](https://discourse.beets.io/t/disambiguation-issues-with-weezer-specifically/29/1 "2017-01-24T18:49:01Z")

</div>

I am importing my Weezer CDs, and I’m seeing weirdness with the disambiguation of the various self-titled CDs.

I have customized my disambiguation to the following:

```
paths:
    default: $albumartist/$album%aunique{albumartist album albumdisambig,albumtype year albumdisambig country label}%if{$albumdisambig, [%title{$albumdisambig}]}/$disc_and_track $title
    singleton: $albumartist/[non album tracks]/$title
    comp: Various Artists/$album%aunique{albumartist album albumdisambig,albumtype year albumdisambig country label}%if{$albumdisambig, [%title{$albumdisambig}]}/$disc_and_track $artist - $title

```

As you can see, I always add disambiguation to my albums if present to get [Deluxe Edition] or whatever automatically, and it’s been working great for a while. The Weezer albums are strange, though, and I wonder how I can fix them.

I use the Chromaprint/Musicbrainz plugin for getting metadata which means that the MB disambiguation comment is used for `$albumdisambig` is that’s usually fine. The problem here is that the Release Group in Musicbrainz has a disambiguation comment of, say, “Blue Album”… and each indiviual release has a disambiguation comment of “Blue Album” as well in addition to anything else like “Deluxe Edition”. That makes the following happen when using `$albumdisambig`:

```
Weezer [Blue Album, Blue Album, Deluxe Edition]
Weezer [Green Album, Green Album]
Weezer [Red Album, Red Album, Deluxe Edition]
Weezer [White Album, White Album]

```

Is there any way non-manual way to fix this such that if I removed and reimported I would get [Blue Album, Deluxe Edition] or [Green Album]? I know I could manually fix this once, but I’d rather make this more automated, especially for potential cases like this in the future. I’m even up to using a plugin like the inline plugin to do text manipulation to remove duplicate strings, but my python is weak. Is $albumdisambig even available to that plugin since it’s not an actual album property?

Also - the duplicates plugin sees them all as duplicates. Is there any way to get the duplicates plugin to use the albumdisambig as a hint that it’s not the same album and import it without asking? I do still want it to ask if disambiguation fails, and I’d rather have it always ask than make a mistake, so if not that’s a small thing.

---

<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 24, 2017, 8:19pm UTC](https://discourse.beets.io/t/disambiguation-issues-with-weezer-specifically/29/2 "2017-01-24T20:19:46Z")

</div>

Interesting! That’s a perplexing problem. How would you suggest that this should work? Are you imagining a special case for when the release-group string is contained within the release string? Or something more general than that?

You can always use a plugin or inline field to manipulate data contained in existing fields, `$albumdisambig` included.

I’m not sure about the duplicates plugin; I thought that used IDs.

---

<div class="post-metadata">

**Author:** ![duckpuppy](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/duckpuppy/32/13_2.png) [@duckpuppy](https://discourse.beets.io/u/duckpuppy)\
**Post date:** [January 24, 2017, 8:23pm UTC](https://discourse.beets.io/t/disambiguation-issues-with-weezer-specifically/29/3 "2017-01-24T20:23:25Z")

</div>

I’m not sure what the right fix is in the general case… I’ve been pondering that for a bit now. In this exact case, yes - removing the Release Group string since it’s exactly duplicated in the actual release comment would be the fix. I’m not sure that works all the time, though.

---

<div class="post-metadata">

**Author:** ![duckpuppy](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/duckpuppy/32/13_2.png) [@duckpuppy](https://discourse.beets.io/u/duckpuppy)\
**Post date:** [January 25, 2017, 2:53pm UTC](https://discourse.beets.io/t/disambiguation-issues-with-weezer-specifically/29/4 "2017-01-25T14:53:20Z")

</div>

My admittedly weak Python fu, plus Google and Stack Exchange, have come up with this

```
album_fields:
  unique_disambig: u', '.join(set([x.strip() for x in albumdisambig.split(',')]))

```

I’m certain this can be improved, but it works in this specific case. Just replace `$albumdisambig` with `$unique_disambig` when the processed string is needed. In my case, I only use it in the final output, changing `[%title{$albumdisambig}]` to `[%title{$unique_disambig}]` in my path template.

---

<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 25, 2017, 6:54pm UTC](https://discourse.beets.io/t/disambiguation-issues-with-weezer-specifically/29/5 "2017-01-25T18:54:59Z")

</div>

Very nice! That’s a creative solution. FWIW, I might recommend a `sorted()` call inside the `join()` argument to make sure the values show up in some stable order.
