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

Hello, :slight_smile:

(I’m french so i will do my best to speak well english :wink:)

Some time ago, I used this topic to solve a problem: I had managed thanks to this topic to classify my artists by First name + Name rather than Name + First name. Everything worked, except that I noticed that for the artists beginning with “The” the artists were in the letter T while I would like that they are, for example for “The Beatles” in B.

Would there be a way so that the Artist Sort Order (and the Album Artist) is the same that the name of the artist excepted for artist beginning with “The” where the order of the artist would be then for example “Beatles, The”?

If anybody had the solution, it would be great! :slight_smile:

Thank you :stuck_out_tongue:

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:



Thank you very much ! :slight_smile:
Everything’s working like i wished.
I added “Les” french equivalent of “The”.
And sorry if my message wasn’t clear for my bad english. :wink:

(And i did the same for album artist)
Here’s what i wrote (if somebody’s interrested)


Thank you again :blush:


Hi, newbie here. I am also having this exact issue, but cannot get the scripts to work for me. Has there been a change? Can someone please screenshot how they have their scripts setup? Thanks in a advance.