Sort-override plugin #6369
future-figs
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone!
I just wrote a plugin for manually changing artist-sort tags. It's similar to the existing
rewrite,advancedrewrite, andsubstituteplugins, but it deliberately changes file metadata. This way, music players can read the file metadata and sort the files the same way beets does.My central use-case is consolidating artists with "alter-egos" or "aliases" -- different stage names used on just one or two projects, for example MF DOOM's "Viktor Vaughn" and "King Geedorah" personas. I want these to be grouped in with the artist's main works, which means changing their
albumartist_sorttags to "MF DOOM" match the mainline discography. It can also be used for one-off collaborations, e.g. sorting the one album by "The Velvet Underground & Nico" under "Velvet Underground, The" alongside their other records without Nico. (This is basically the same rationale as the existing plugins.)All the "overrides" are set up in the config file. Under the
albumartists:section, you can list any number of desiredalbumartist_sortvalues, and for each, any number of beets queries for albums onto which that tag will get stamped. That'ssort_as:andaliases:, respectively. I'm pretty happy with this syntax; it's readable no matter how many "aliases" an artist goes by, you can use musicbrainz IDs instead of writing out artist/album names, and regex works.The plugin triggers automatically at the end of the import process, when the sort tags get populated, and it can be re-run anytime with its own command. It's safe to run
mbsynclater, as it doesn't overwrite sort tags. If you really screw up the sort tags, you can disable the plugin and re-import problem albums (beet import -L $query) to get the default sort tags back from musicbrainz.There are some potential areas for improvement:
beet write/beet movealbumartist_sorttoartist_sortas well -- this is a hack needed for my music player, which readsartist_sorteven when sorting albums, not tracksartist_sortvs 'albumartist_sort` -- I like albums, so this isn't my use-case and I have no idea how one might want tracks sorted by artist to look likeI attached the plugin file. Here's my
config.yamlsetup:If it looks helpful, give it a shot and tell me what you think! I can try to put this into a PR if there's a desire.
sortoverride.py
Beta Was this translation helpful? Give feedback.
All reactions