Problem with artists starting by "The..." in "Album Artist Sort Order" and "Artist Sort Order"

Just to clarify for others reading this: Having “Beatles, The” is the default for the sort name. The issue here is that the default sort name is not being used as in this case tdurivault wants to sort persons by first name, last name. So a script like the following is used:


To also fix the sorting for bands starting with The you can use the swapprefix function:


By default $swapprefix will move “The” and “A” at the beginning to the end, so “The Beatles” becomes “Beatles, The”. If you also want other prefixes moved, e.g. for other languages, you can set the prefixes as additional parameters. E.g. to also swap “Die”, the German equivalent of “The” in e.g. " Die Toten Hosen", you can do that: