Quarter Life Crisis

The world according to Sven-S. Porst

« Mother NightMainBug Report Friday: Safari auto-fill »

iTunes 5 Artist sorting patch

1132 words on ,

After my recent post on iTunes 5 there have been requests for a more detailed description of how to improve iTunes’ localised band sorting which also spoils the sorting on the iPod. In its English localisation, iTunes is set up to sort bands with names like ‘The Strokes’ as if they were called ‘Strokes, The’ – thus giving them a more natural position in the artist list in both iTunes and the iPod.

You will not need this patch for iTunes 7.3 and higher as Apple finally restored the proper artist sorting there. It was necessary for iTunes 5, 6, and 7.0 and for iTunes 7.1 and 7.2 it was crucial to apply it before first launching the application. —— The patch also seems that it works in a similar way on iTunes for Windows. All you need to do is find a folder iTunes.Resources in the folder of your iTunes application there to locate the same file I describe the change for below.

For other languages than English, iTunes 5’s localisation replaces the ‘The’ by the appropriate article from the respective language. This sorts local bands just fine. But as everyone is listening to English bands as well, it will leave English bands sorted badly and makes them hard to find – a situation that has been better in the later versions of iTunes 4. Here I’m trying to give a description on how to fix the problem yourself. While it’s not particularly nice, it isn’t a terribly hard thing to do. To be able to do this you’ll need a text editor and use an account that lets you write to the iTunes application. You may want to make a backup copy of the complete iTunes application in case things go wrong.

Opening the iTunes package The first steps are to quit iTunes and open iTunes’ package in the Finder. To do that control-click the application and select the third item in the menu that appears. It should read something along the lines of ‘Show Package Contents’ in your langauge. This will open a new window showing a folder ‘Contents’. Open that folder and also the folder ‘Resources’ contained in it.

iTunes 5's package and some of its contents Within the Resources folder there are many different files and folders. Folder whose name end in ‘lproj’ are relevant for the localisation. iTunes will load data from the folder that corresponds to your preferred language. For many languages the proper name is used but for others, like Swedish, an abbreviation like ‘sv’ is used. Go and find the folder that is appropriate for your language and open it. Within the folder is the file ‘Localizable.strings’. This is the file containing the relevant strings and we are going to change it. So if you haven’t made a backup copy of iTunes a few paragraphs ago be sure to at least make one of this file before you change it.

Now open that file in a text editor. TextEdit in its standard setup will work for this but any other editor that can handle Unicode files will do as well. If the file doesn’t look right, and accented or other ‘special’ characters like the © sign in line 17 look garbled something went wrong and you should try to explicitly open the file as a UTF-16 encoded one.

Once the file is open, find the relevant strings. They are around line 345 and labelled by ‘146.xxx’, where xxx is a number. Note that the x-es start with 001 and increase in numbering. The German version of those strings looks like this:

/* ===== Reordered Artist Strings ===== */
"146.001" = "Die ";
"146.002" = "%1, Die";
"146.003" = "die ";
"146.004" = "%1, die";
"146.005" = "DIE ";
"146.006" = "%1, DIE";

It Tells iTunes that when it finds a band whose name starts with ‘Die ’ to sort it as if the ‘Die’ were appended at the end, in the form “%1, Die”, where %1 is supposed to denote the remainder of the band’s name. Note two things here. First, capitalisation is important, i.e. there have to be separate entries for instances of the same word with potentially different capitalisation. And second, in the lines with odd numbers there is a space at the end of the string. You shouldn’t forget that as it ensures that, e.g. ‘Thelonious Monk’ won’t be sorted as if his name were ‘lonious Monk, The’.

All that remains to do now is to add the additional re-sorting instructions you may want. Just add two new lines containing the strings to match and replace and make sure their numbers increase appropriately. Make sure that you’re not missing any of the quotation marks or semicolons! The most obvious addition would be something like this:

"146.007" = "The ";
"146.008" = "%1, The";
"146.009" = "THE ";
"146.010" = "%1, THE";
"146.011" = "the ";
"146.012" = "%1, the";

That’ll sort the English names. And once you’re at it you may think about adding strings for other languages as well. Perhaps add ‘Les’ as well for French, or add ‘Der’ and ‘Das’ as well for German. I am not sure whether the latter ones are appropriate, though, but as you’re changing stuff yourself now, you can adjust things to match your taste…

As for ‘matching your taste’ you could also abuse this to re-sort things more boldly. I.e. if you’re a big fan of Mando Diao and think it’d be nice to have them listed at the top of your iTunes and iPod artist lists rather than having to find them in the middle of hundreds of bands you could try adding something like
"146.013" = "Mando Diao";
"146.014" = "00001";

which should make sure the band is listed very far at the top. I’m not really recommending to do this as it makes the list less logical, but it could be useful to some.

After saving the file with the changes made, you should be able to start iTunes again and it should sort band names in the way you intended.

Finally let me note that you’re doing all this at your own risk and any future updates to iTunes, in case they don’t fix the problem anyway, may reset your changes so you’ll have to apply them again. If you want changes for several languages, you’ll have to update the ‘Localizable.strings’ file for each of them. Please don’t complain about those inconveniences, at least not to me… but if you’ve made it up to here you’re probably looking for that kind of trouble.


If you really enjoyed doing this, you may also be interested in looking at my old iTunes patch which makes the little arrows next to song, band and album names which take you to the relevant section of iTMS or your music library more subtle.

September 15, 2005, 0:51

Tagged as iTunes, patch.

Comments

Comment by Dave2: User icon

Ah… thank you so very much! You solved what a “genius” at Apple’s so-called “Genius Bar” could not! I have a small collection of foreign music, and this hack is much appreciated!

September 15, 2005, 1:46

Comment by Brian: User icon

Woah, Thanks a lot!

My Mac OS X is in English, but I speak in Spanish, so I have a lot “Spanish” artists. with this hack you solved this annoying sorting thing…

September 15, 2005, 3:13

Comment by ssp: User icon

Dave,

not that I mind too much, but you may be a bit too harsh with the ‘geniuses’. As I mentioned somewhere, the convenience of iTunes’ strings being stored in a text file is a novelty of iTunes 5. In one of the linked posts I describe how you had to do the same patch in previous versions of iTunes. That involved some resource fork / data fork swapping and use of ResEdit. And I wouldn’t be too bitter if today’s ‘geniuses’ aren’t all that familiar with such old-school tools.

Basically I assume that the ‘geniuses’ get more of a training focused on typical end-user problems. And this isn’t one of them. I’m not even sure that it’s important for them to be terribly technically minded.

September 15, 2005, 15:51

Comment by Sebastian: User icon

Thanks a lot for this patch!

I hate it when things become worse instead of better with a new version.

September 16, 2005, 13:29

Comment by Carl: User icon

Interestingly, Japanese iTunes works the same way in version 5 as 4, namely “The” is sorted English-style. Probably, the reason is because Japanese has no articles (“a”, “an”, “the”), definite or otherwise.

September 18, 2005, 14:35

Comment by Ole: User icon

Thanks! Very nice!

September 25, 2005, 12:28

Comment by Marcel: User icon

Hi Sven

Thanks for the patch! Cured artist sorting perfectly.

Would it be possible to use a similar approach for album name sorting? I have a lot of albums containing “The ” or “The Complete “:

I would like to sort:

The Amazing Bud Powell The Complete Birth of the Cool

under

Amazing Bud Powell, The Birth of the Cool, The Complete

Is that possible?

Thanks and regards from Switzerland, Marcel

October 29, 2005, 12:00

Comment by ssp: User icon

Marcel,

I can’t see how this would work. I seems like iTunes only modifies the band names and doesn’t touch the album names.

You might try filing a feature request with Apple. But I wouldn’t count on it helping much…

November 13, 2005, 15:23

Comment by Matt A: User icon

THANK YOU!!! This works nicely! Although do you have a tip like this so that I can properly aplhabetize song titles?

September 17, 2006, 2:59

Comment by ssp: User icon

As far as I can tell, iTunes doesn’t have a comparable mechanism for song or album titles.

September 17, 2006, 17:25

Comment by warpoholic: User icon

Ver*?#mt. Ich machen den Patch schon seit das Problem auftauchte. Nun habe ich wohl aus Versehen 7.1 schon kurz geöffnet gehabt. Das klappt nun nicht mehr. Gibt es eine möglichkeit die Datenbank neu sortieren zu lassen ohne die ganzen schönen Daten wie Zähler & co zu verlieren?

Danke Gruß edgar

March 14, 2007, 20:19

Comment by ssp: User icon

Das dürfte schwierig werden.

Wenn es kein Backup gibt, könnte bei wenigen Bands ein manuelles Nachbearbeiten helfen und bei vielen Bands vielleicht ein Script.

Ich habe meine Ideen zu dem Thema im iTunes 7.1 post hingeschrieben.

March 14, 2007, 23:52

Comment by Marcel: User icon

Fixed in iTunes 7.3!:

http://www.macnews.de/news/100846.html#

“skorupka · 29.06.2007 /22:19 Uhr Aber der absolute Hammer ist: iTunes sortiert jetzt vernünftig!! :-) (jedenfalls funktioniert es jetzt bei mir…) Es erkennt Artikel (Englisch und Deutsch) und z.T. Sonderzeichen und sortiert entsprechend anders. Ich habe mich zuerst gewundert, warum meine Alben plötzlich in einer anderen Reihenfolge sortiert sind, aber so ist es jetzt richtig klasse!! …”

July 1, 2007, 12:02

Comment by ssp: User icon

Yeah that’s a great improvement of iTunes 7.3 - see my post on iTunes 7.3.

July 1, 2007, 12:46

Add your comment

« Mother NightMainBug Report Friday: Safari auto-fill »

Comments on

Photos

Categories

Me

This page

Out & About

pinboard Links

People

Ego-Linking