Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Use iTunes Groups and AppleScript to sort music Apps
iTunes is one of the best applications Apple has produced. However, once the song database increases, it becomes very difficult to organize the songs it contains. Some songs are present in multiple groups. Though we can manually create the groups and maintain them, its a very cumbersome process. Also, there is no formal method for having the same song in multiple groups (or genres). One possible option is to use "Comma Seperated" genres. However, using this method, it is not possible to "add" a genre to a bunch of songs while keeping the existing genres intact using present options.

I've created a couple of scripts to work around this limitation using Groups. Instead of Genre, the script allows us to add/remove group to the "Grouping" field in the song, which is mainly unused. As an example, a song may fall into Remix, Dance and HipHop categories. We can manually create playlists for all the three and add the song to that. However, if we wish to create a new playlist, which contains all the songs of Dance and HipHop categories, then it's not easy to do manually. It becomes more complicated when we add a new song to Dance category, we have to remember to update our new playlist also.

To achieve this result, however, you can use this script to "Add" a group to the selected song(s). Once proper groups have been added, "Smart Playlists" can be generated that contain these categories. Also, a single group can also be removed from the selected songs without modifying other groups.

[robg adds: I downloaded and tested the scripts; they work as described here. I don't do much with grouping music using Genres (Smart Playlist -> Not Recently Played is my usual mode of listening), but if you do, this unused field and these scripts could come in handy.]
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (2 votes cast)

Use iTunes Groups and AppleScript to sort music | 11 comments | Create New Account
Click here to return to the 'Use iTunes Groups and AppleScript to sort music' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Use iTunes Groups and AppleScript to sort music
Authored by: momerath on Feb 26, '04 12:11:39PM

I use grouping for classical music (the groups I use are Symphony, Strings, Piano, and Cello) and then use smart lists to have playlists comprised of only groups of classical music. Grouping is handy.

[ Reply to This | # ]
Use iTunes Groups and AppleScript to sort music
Authored by: DougAdams on Feb 26, '04 12:37:57PM
Dwipal's scripts are pretty cool. I host them at my site as well.

Remember that the iTMS uses Grouping as a dynamic display feature. Nobody is sure at this point, but it is reasonable to speculate that a future version of iTunes will also use the same effect. Be careful how you commit yourself to using Grouping.

[ Reply to This | # ]
Authored by: terceiro on Feb 26, '04 04:58:26PM

I use genres all the time for listening -- most of which is actually away from the 'puter using my iPod. While iTunes is swell, I only wish that the iPod OS would act the same way.

Unless there *is* some way which is known to all but me...?

[ Reply to This | # ]
Use iTunes Groups and AppleScript to sort music
Authored by: KRC on Feb 26, '04 06:37:57PM

There was a long thread in the Apple Discussion Forums that discusses grouping: <a href=>here</a>

You might want to check it out.

As with me, I usually use Grouping as a sub-genre sort of thing or placing a group of music in one piece (like some Classical music scores).

Hope that helps.

[ Reply to This | # ]
Use iTunes Groups and AppleScript to sort music
Authored by: the_argonaut on Feb 26, '04 07:35:50PM

Warning to the masses though: your iPod does not (yet) support the Grouping field. This bit me in the butt after I created a smart playlist only containing tracks where "Grouping contains Live Performance" only to find that the playlist was empty on my pod. Here's looking forward to a iPod software update in the (hopefully) near future. . .

[ Reply to This | # ]
Use iTunes Groups and AppleScript to sort music
Authored by: dwipal on Feb 29, '04 05:16:23PM

I have added new scripts (at the same site) to do the same thing for genre/comment. IPOD will update the tracks for those.

Thanks for bringing this to attention !! I wonder why iPOD does not show tracks for smart playlists based on groups.

[ Reply to This | # ]
comments field
Authored by: mclbruce on Feb 27, '04 02:06:27AM

I put keywords in the comments field and use those to generate my play lists. Keywords can be a genre or "Live" or whatever works for categorizing the music. Then all of my playlists are smart playlists with conditions like "Comment contains Live"

It's a simple system that works well. Note that you can edit the comments field for many songs at once.

[ Reply to This | # ]
Avoid Scripts/Use Genres?
Authored by: jason mark on Feb 29, '04 09:07:45AM

I've simply added more words to my Genres. For instance I classify some music in the genre "Classic Rock, Folk" and other music in "Rock Heavy Metal".

Then my playlists are built upon the "contains" command. For instance I have a playlist which says "play all music where the gener contains "folk".

Also note, in iTunes you can select multiple tracks at the same time, and hit Command-i and change the Genre (or whatever) of mulitple songs.

These scripts are a *little* more elegant, the Genre field works just fine, there's not need to turn on groups too...

[ Reply to This | # ]
Avoid Scripts/Use Genres?
Authored by: dwipal on Feb 29, '04 03:45:10PM

Thanks everyone for your comments.
A Few Clarifications (mainly on the Grouping field):

QUE1: Why did you use grouping field ? Its use for something else.

ANS: I was aware that the grouping field is used for some other purpose, which is already present in iTMS currently. It wont be much time when it will be present in iTunes or iPOD. However, i felt it was a pretty vague feature to use it on its own, and for 90% of the songs it was left usused. So i felt like using it.

QUE2: Why not other field (Like Comment or Genre).

ANS: Comment can be used for other purposes, like adding a true comment (like "My girlfriend played this song on her 20th birthday").

iPOD allows us to list songs according to their Genre, so if i put multiple genres in the songs, it still treats all of them as a "Single" genre. So there
are lots of unique genres suddenly created. So adding multiple genres to a song didnt seem very appealing.

Also, i can "edit" multiple songs at the same time to change their group (or comment or genre). However, all the songs are updated and made the same. Old values are overridden.

If i get a requests from a few people, then i can release the version of the script that uses Comment or Genre field instead of Group field.

[ Reply to This | # ]
Avoid Scripts/Use Genres?
Authored by: dwipal on Feb 29, '04 05:14:07PM


Download the latest version from


[ Reply to This | # ]
Use iTunes Groups and AppleScript to sort music
Authored by: Jaharmi on Mar 01, '04 06:05:00PM

The more ideal solution for me would be to have the ability to create/maintain new fields in iTunes. Those fields should then be available for Smart Playlists in iTunes and on the iPod.

Make iTunes more like a database manager. I'd like to be able to have fields that have special content -- dates, checkboxes/radio buttons, etc. I'd like to be able to display that information in the track list under new columns.

I've been using the Comments field for some sorting for Smart Playlists for a long time -- since the debut of Smart Playlists -- and am moving away from it. It's clumsy to me, and frustrating to keep up to date, no matter how I scripted it.

[ Reply to This | # ]