Skip to content

Use flexible attributes as aunique keys #3553

@gregforcey

Description

@gregforcey

Use case

I would like to be able to use flexible attributes as aunique keys for disambiguation. One use case of this would be when having multiple versions of the same album in different resolutions: 16/44 and 24/96, for example. In this case beets should treat the same album in different resolutions as a different album and thus not add the disambiguators at the end of the album name if this occurs.

Solution

Something like the following is how it should be implemented:

aunique:
    keys: original_year albumartist album album_bitdepth album_samplerate
    disambiguators: albumtype label catalognum albumdisambig releasegroupdisambig
    bracket: '{}'

album_fields:  
      album_bitdepth: |
       total = 0
       for item in items:
           total += item.bitdepth
       return round(total / len(items))
    album_samplerate: |
       total = 0
       for item in items:
           total += item.samplerate
       return round(total / len(items) / 1000)

Alternatives

I posted a question in the forums and it was suggested I file a feature request. I don't believe there are any alternatives

Related issue

#2678

Metadata

Metadata

Assignees

No one assigned

    Labels

    featurefeatures we would like to implement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions