Re-ordering 'The' in artist names - a custom rule
July 04, 2017 in digital music by Dan Gravell
Back to custom rules this week!
Custom rules are not a particularly well used feature in bliss. I understand why; they're difficult to set up. There are some ways we could make this much easier. But for now, I wanted to demonstrate another example of using custom rules.
This week, assessing artist names and moving "The" to the end of the artist name.
It's a pretty common pattern in music libraries to sort artists ignoring stop words. When it comes to musical artist names, perhaps the most common stop word is The. You might have heard of a band called The Beatles... they were big in the 60s, look them up.
Many people want to ignore stop words because it makes their collection easier to browse. Rather than having a mountain of artists beginning "The" stored under "T" in their collection, they'd rather have The Beatles under "B", The Smiths under "S", The The under... hang on.
It's possible to use the ARTISTSORTORDER
tags to fix artist sorting but (1) not all music players support that tag and (2) the artists will still appear with The at the start, which may not be what you want.
To re-order artists, you need to move "The" to the end of the artist name in the tags inside your music files. There's no such out-of-the-box rule in bliss, but it's easy to accomplish with custom rules.
Creating a custom rule involves these steps:
- Create a new
.regexrule
file. - Enter the code for the custom rule into the file and save it.
- Restart bliss.
- Enable the rule in settings.
So first we create the file. The file should be stored in the regex-rules
folder inside the bliss settings folder:
Windows XP | C:\Documents and Settings\[username]\.bliss |
Windows Vista, 7, 8 and 10 | C:\Users\[username]\.bliss |
Mac OS X (see below) | /Users/[username]/Library/Preferences/bliss |
Linux | /home/[username]/.bliss |
Docker | /config (within the container); find where this is mounted from in the run command |
Synology | /var/packages/bliss/target/var/.bliss |
QNAP | `getcfg SHARE_DEF defVolMP -f /etc/config/def_share.info`/.qpkg/bliss/.bliss |
VortexBox | /root/.bliss |
So on Windows, that's C:\Documents and Settings\[username]\.bliss\regex-rules
. Save the code below into a file suffix-the.regexrule
inside the folder:
Now restart bliss and we get a new setting:
There I've chosen the two options so that all ALBUM_ARTIST
and ARTIST
tags are inspected. Once I Apply rules I get these types of assessment:
Click the one-button fix and we get:
Fixed! Now time to rescan my music player to make sure The Avalanches appear "Avalanches" first.
Work for the reader
The two main problems with the above code are that (1) stop words other than "The" aren't supported and (2) neither are other languages.
Both can be fixed in the same way. Use an OR expression to combine "The" with other words. For example:
find /^(?i)(The|Le|Der|Die)\s(.*)$/ replace with "$2, $1"
... should work for internationalisation, and a similar approach will work for adding stop words.
Thanks to Paul Dufour for the image above.