iPodYearSort

Meowski suggled up with her iPod

Introduction

If you view an artist in the iPod's menu system it shows you their albums, and any compilation albums they feature on, sorted alphabetically. I wanted to see the albums sorted by release date (Year tag) and I also wanted to separate each artist's main albums from the compilations. This tool achieves that by setting adjusting the SortAlbum tags in iTunes which in turn change the way the iPod menus display things.

This tool only works with the Windows version of iTunes since it uses the iTunes COM SDK. What it does is very simple so someone who knows AppleScript could easily write an equivalent for OS X.

Note that iTunes (but not the iPod) can already sort albums by year without the use of this tool (click the Album column header a few times until it changes to "Album by Year"). This tool only exists to get something similar on the iPod.

Example

I have these Radiohead albums on my iPod:

    (1993) Pablo Honey
    (1995) The Bends
    (1997) OK Computer
    (1998) Airbag - How Am I Driving
    (2000) Kid A
    (2001) Amnesiac
    (2001) I Might Be Wrong - Live Recordings
    (2003) Hail To The Thief
    (2007) In Rainbows

I also have two compilation albums featuring tracks by Radiohead:

    (1996) Romeo + Juliet
    (2005) Help - A Day In The Life

Before using iPodYearSort, if I selected Radiohead on my iPod I would have seen this list:

    Airbag - How Am I Driving
    Amnesiac
    The Bends
    Hail To The Thief
    Help - A Day In The Life
    I Might Be Wrong - Live Recordings
    In Rainbows
    Kid A
    OK Computer
    Pablo Honey
    Romeo + Juliet

The albums were sorted alphabetically and compilations were mixed in with proper albums.

After running iPodYearSort, the Radiohead menu will look like this:

    Pablo Honey
    The Bends
    OK Computer
    Airbag - How Am I Driving
    Kid A
    Amnesiac
    I Might Be Wrong - Live Recordings
    Hail To The Thief
    In Rainbows
    Romeo + Juliet
    Help - A Day In The Life

Everything in its right place. When Radiohead release their next album it will appear at the end of the main list (just before the compilations start), rather than in an arbitrary place depending on what they decide to call it. If I buy more compilations that feature Radiohead then they won't get in my way when I'm trying to decide which of their proper albums to play.

How It Works

Both iTunes and the iPod support a tag called SortAlbum. The value of this tag is never displayed but, if it isn't blank, the value will be used instead of the actual album title when sorting the list. Similar sorting tags exist for things list artist names. A typical example, which iTunes configures automatically, is if you add a song by The Beatles. The Artist tag will be "The Beatles" but the SortArtist tag will be set to "Beatles". The band appear under B, rather than T, but are still called The Beatles.

The iPodYearSort tool creates SortAlbum tags in this format:

    <Year> <Title>

For example, the albums Under The Pink (released in 1994) and American Doll Posse (released in 2007) would have their respective SortAlbum tags set to:

    1994 Under The Pink
    2007 American Doll Posse

This means that the older album will come before the newer album, even though their album titles sort the other way around.

If an album's AlbumArtist tag starts with "Various" then the tool assumes it is a compilation album. A slightly differnet SortAlbum format is used in this case:

    9999 <Year> <Title>

This makes compilations come after proper albums.

(iTunes has a special tag "Part of a Compilation Album" but, unfortunately, the tool cannot detect this tag as it is not supported by the iTunes COM SDK. This is why the tool checks for AlbumArtist tags that start with "Various" instead.)

Usage

iPodYearSort is a very simple tool that can only be run from a Command Prompt. There is no fancy GUI interface, sorry.

From a Command Prompt you can run one of the following commands:

  • iPodYearSort.exe /Describe

    Prints a detailed description of what the tool does. If you've already read this webpage then you won't learn much from this.

  • iPodYearSort.exe /PretendWrite

    The tool will scan your iTunes library and tell you the changes it would make in order to make your albums sort by year. It won't actually change anything, though.

  • iPodYearSort.exe /RealWrite

    The same as PretendWrite except that the tool will actually perform the changes. You should run PretendWrite first at least once to make sure you understand what you are about to do to your music collection's tags!

  • iPodYearSort.exe /PretendClear

    The tool will scan your iTunes library and tell yo the changes it would make in order to restore the default sort order. It won't actually change anything, though.

  • iPodYearSort.exe /RealClear

    The same as PretendClear except that the tool will actually perform the changes. Running this should, in theory, undo any changes made by the tool if you decide you prefered things the way they were. Of course, any custom sort tags that you had defined yourself will be wiped.

You are strongly recommended to use the Pretend modes before doing any changes for real. This will alert you to any errors (e.g. if your tracks don't have Year tags) and will give you a better idea of exactly what is about to happen before it's too late.

After you have written changes to your tags you will need to sync your iPod. Unfortunately, the first time you use the tool will trigger a complete re-sync of all affected files, including the actual music data, even though only the tags have changed.

Whenever you add new music to your library you should run the tool again so that the new files' tags are updated. The tool will only update the new files so you do not have to worry about changes to old files causing them to be re-synced.

Download

iPodYearSort_1001.zip (62KB) (PGP sig)

The program is standalone exe file and does not require any installation or uninstallation. It doesn't write any configuration data or modify anything other than the iTunes library tags.

The zip file includes a Source directory containing C++ source code. If you are not a programmer then you can ignore/delete it.

Be sure to read the Usage section because the tool does not have a user-friendly UI!

History

Version 1.0.0.1 (20th October 2007)

  • Initial release.
  • Tested with iTunes 7.4.3.1 on Windows Vista
  • Tested with iTunes 8.0.0.35 on Windows Vista (September 2008)
  • Tested with iPod Classic firmware 1.0.2 (PC)