Skip to main content
Topic: Genre Alphabetization script (Read 1553 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Genre Alphabetization script

Here's a script I put together for use with Masstagger which automatically alphabetizes your multi-value genre tags!  I looked online and in the documentations for what tag editing tools I have, but was unable to find any function or feature such as this.  Since I have a decent understanding of foobar's scripting syntax (not that it's astrophysics), I went ahead and made it myself.

I am extremely particular about the tags of my audio files, and in the pursuit of a way to cleanly handle bulk amounts of tags in my large library, I ended up making this.  Since I put a good 10 hours or so into the process of making/documenting the script, I felt like sharing it with the fb2k community in case it could help someone else as well.

To use this script, you will need the Masstagger component.  In the context menu of the files you'd like to preview/run the script on, go to Tagging -> Manage Scripts, select "Import from file...", and locate the file "Genre Alphabetization xxx.mts".

Please read the brief documentation provided before running the script on any of your files, as there are some points to note that aren't listed here!

Current features:
  • Sorts up to six multi-value %GENRE% metadata fields by first letter.
  • Warns you in Masstagger output preview if more than six values are present (extras are simply ignored).  This should never be a problem unless you go far overboard with your tagging.
  • Accepts Unicode characters/strings (i.e 越天楽, ポップス, 재즈, or الريغي), sorting them before latin alphabet characters.  Note that all non-alphanumeric characters are created equal, and thus are shuffled around randomly amongst themselves (rather than usefully sorting by Unicode value) when running the script.  If you only use alphanumeric characters for your genres (A-Z, 0-9), this won't affect you.
  • Cleans up after itself.
  • Backs up original %GENRE% tags to %GENREBU% (in the format "genre1; genre2; ...") for easy reversion of changes.
  • An extra script is provided for easy reversal of this script's actions (utilizing the %GENREBU% tag).

Current noteworthy limitations:
  • Can only sort based on the first character. Genres such as Trance/Techno, Soundtrack/Symphonic, etc. are not properly sorted.
  • Shuffles genres with the same first letters on each run of the script.  For example, upon initial script execution, a song with genre tags "Techno; Dance; Trance; Electronic" will be sorted to "Dance"; "Electronic"; "Trance"; "Techno". Given a second run, the script will swap the two "T" genres, resulting in "Dance"; "Electronic"; "Techno"; "Trance".
  • Discards any %GENRE% values after the sixth metadata value.

Feedback is welcome, especially if anything doesn't seem right!  I've tried to test this as extensively as possible to spot any errors I may have made, but I'm only human and definitely not an expert when it comes to Masstagger. ;)

SimplePortal 1.0.0 RC1 © 2008-2020