# Singleton disambiguation

**URL:** <https://discourse.beets.io/t/singleton-disambiguation/1036>\
**Category:** Help\
**Created:** [December 14, 2019, 7:49pm UTC](https://discourse.beets.io/t/singleton-disambiguation/1036 "2019-12-14T19:49:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Atir](https://avatars.discourse-cdn.com/v4/letter/a/ec9cab/32.png) [@Atir](https://discourse.beets.io/u/Atir)\
**Post date:** [December 14, 2019, 7:49pm UTC](https://discourse.beets.io/t/singleton-disambiguation/1036/1 "2019-12-14T19:49:20Z")

</div>

Looking at the Path format docs, I see that I have access to `albumtype` (useful for differentiating concert bootlegs from studio albums, for example), as well as the `%aunique{}` function and `albumdisambig` value. There doesn’t seem to be anything comparable for singletons, though.

The problem I’m trying to solve is the case where an artist plays one particular song at many concerts, and I like the song enough to collect many live versions of it and compare the variations from one performance to another _without_ having the whole concert setlist in my collection as an ‘album’. Under my current setup, if I just keep hitting `Keep both`, I end up with `Cornflake Girl.1.mp3` through `Cornflake Girl.17.mp3`, for example, which is not ideal. As far as I can tell, using the Musicbrainz disambiguation comment (as described [here](https://musicbrainz.org/doc/Style/Recording#Live_recordings)) to generate filenames like `Cornflake Girl live 1996-06-08, Milwaukee, Wisconsin, USA.mp3` seems like the most elegant way to achieve this.

So the question is, what’s the least painful way to get there from here? I assume Path formats don’t have undocumented access to pull arbitrary fields out of the raw musicbrainzngs dict object… do they? Assuming that’s a no, how about a snippet for the Inline plugin? From there, can I pull the `disambiguation` field from the musicbrainz entry that beets has already retrieved for the current item during import? And if so, would something like the following be enough to do it?

```
item_fields:
    disambig: disambiguation

```

…and then just refer to `$disambig` in my `singleton:` Path format (which would presumably not add anything if the `disambiguation` field is not set)?

I feel like that looks way too easy and I must be missing something. Am I missing something?

Also, should I open a Github issue for adding the item disambiguation field to the built-in list of Path values? This strikes me as a thing that might be useful for a fair number of people, and probably a relatively painless change to implement.

---

<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:** [December 14, 2019, 11:42pm UTC](https://discourse.beets.io/t/singleton-disambiguation/1036/2 "2019-12-14T23:42:24Z")

</div>

> [@Atir](#):
>
> I assume Path formats don’t have undocumented access to pull arbitrary fields out of the raw musicbrainzngs dict object… do they?

Sadly no; we don’t keep the full MusicBrainz API response (which can be quite complex and nested). An `inline` incantation also can’t work around this.

We do currently fetch the disambiguation string for MB _works_ (`work_disambig`), but I don’t think that’s what you’re after here. We will need to separately fetch the _track_ disambiguation, as mentioned here:

> <https://github.com/beetbox/beets/issues/1904>
>
> I download a lot of singletons, and I use the track disambiguation notes frequen…tly. I saw that Beets has a way to note the \*\*album\*\* disambig, but not the \*\*track\*\* disambig. Can this be inserted into a future release? This way, my beets.yaml config could look something like this:
> 
> \`paths:
> default: $albumartist\_sort/\[$year\] $album/$track. $artist- $title
> comp: Various Artists/\[$year\] $album/$track. $artist- $title
> singleton: $artist\_sort/$artist- $title \[$trackdisambig\]
> \`

It shouldn’t be too hard, but it will take some effort. Please feel free to jump in if you feel you have the skills!
