Apparently, today is iTunesRater’s first birthday. It was a year ago today that I first posted about the program I had created to rate tracks on a 0-100 scale. And it was only a couple of days ago that I realised most of the rating I’ve done has been a bit of a waste of time: iTunes seems to only take into account the actual star rating, not the real value. Except for tracks that are 1/2 star. I’m going to write a post on OmniNerd detailing my experiments and results, when I get a bit of time.
I had a thought just before. (Unusual, I know). I wrote a program called iTunesRater so I can rate my music as I listen to it in iTunes, and then went on to write a series of Adium Scripts to control iTunes ratings, and get data from iTunes.
What if instead of having to create scripts for iTunes that did everything you want, you just create a bot that runs, and you send messages to it, and it controls iTunes. So, I could have the program running, and instead of having to type:
_♫ The Chemical Brothers (Feat. The Flaming Lips) • The Golden Path _
♫ The Chemical Brothers (Feat. The Flaming Lips) • The Golden Path ★★
I could just start up a chat with iTunes, and type all sorts of commands:
it: ♫ The Chemical Brothers (Feat. The Flaming Lips) • The Golden Path
me: rate 44
it: ♫ The Chemical Brothers (Feat. The Flaming Lips) • The Golden Path ★★
me: next track
[iTunes next track plays]
All it would seem to require is a program that can connect to a server of some sort (I think maybe Jabber, then I can run my own Jabber server!), and sends AppleScript messages to iTunes. Or any other application, for that matter.
I borrowed Cocoa Programming for Mac OS X from the library the other day. I’ve read most of it, away from the computer, although I plan to reread it in front of the iMac over the next few weeks. I’ll write a review of it a bit later, but it reminded me that I still have a memory leak in iTunesRater. Also, I think I’ll rewrite iTunesRater as a Cocoa Objective-C application, rather than AppleScript Studio. Then I can just use an AppleScript message to get/send data, rather than relying on AppleScript for interface updates. That way the application may be a bit snappier. And hopefully I’ll overcome the memory leak. I was actually thinking of a refactor anyway, as there’s a whole heap of semi-duplicated code in there.
iTunesRater seems to be leaking memory, and I think I know where. I discovered this by just watching the amount of memory it used, and each time a new track plays, the memory usage goes up. I think it’s to do with the artwork display: I thought I deleted the image being displayed, but maybe I don’t. Before I update the image with a new one, I use the code:
delete image of image view “Artwork”
(both times: when I replace the artwork in the main window, and the previous track drawer). However, unless I’m missing something else, this is where the leak is!
Whenever I listen to iTunes now, I have iTunesRater running, and attempt to rate tracks as I hear them. I have my Unrated playlist running through Party Shuffle, and have to rate each song before it ends. Wouldn’t it be nice to be able to rate the previous song. I’ll try to code this into iTunesRater….
I’ve included the ability to rate the previously playing song in 0.7 When iTunesRater knows the current song, and the previous song, it will activate a checkbox: Show Previous. Clicking this button will open a drawer with the details of the previous played song, which can be rated. I seem to have made the whole thing run a bit slower now, I’m going to refactor everything at some stage. But not right now… Edit: Whoops! Big bug there - if a track doesn’t have artwork, iTunesRater spits it bigtime…fixed now though. Get 0.75 from iTunesRater0.75.zip.
When I was trying to find the name of the song they use in Classic FM for a theme tune, I discovered a bug in iTunesRater - it only checks the title of the song, not anything else. So two songs with the same title played one after another won’t necessarily change the iTunesRater display. Of course, attempting to fix this has caused some other issues…
I wrote iTunesRater because I wasn’t happy with only having six possible ratings for each song - I have 5665 songs in my iTunes Library, and this isn’t a fine enough grained distribution. I’ll be honest, at times 0-100 isn’t enough! I also wrote it because I wanted a window always open that can be used to rate tracks easily as I listen to them. My Party Shuffle grabs tracks from an Unrated playlist, which is every song with a 0 rating. (I use this as the base, and songs I hate get a 1-10ish rating. Because of my setup, where a server contains all of the songs, and multiple people can add tracks to this location, and every now and then you need to import the folder containing music, removing a track just means it would be added again later). Today, just out of interest, I looked at how many songs are in the Unrated playlist. 4472. That means I have only rated about 22% of my music. I could short-cut it a bit, and rate according to album, but I don’t usually like every song on an album. And lots of times, I don’t know the names of songs, I have to wait until I hear them. If I had an iPod, I might rate more, but then it would only be a 0/20/40/60/80/100 rating again. And I’d have to sit on the train with my iPod in my hand, and I like to read on the train.
There seems to be some sort of a layering bug with Interface Builder - I notice it sometimes in development builds of iTunesRater: As you can see, some of the widgets, sorry, views, are partially obscured. Sometimes it is worse than others, with all of the fwd/play/rev buttons covered. Sometimes it is fine. I generally have to just play around shifting different views to the front to get it all okay. Needless to say, it looks fine in Interface Builder.
Canon in D Major from the album “Adagio Karajan” by Berlin Philharmonic Orchestra
iTunesRater 0.6 has been released. Saving prefs works a bit better now, but the only way to change the maxRate and minRate variables is through:
defaults write iTunesRater maxRate <value>
AutoRating is working, and the program now remembers the last state for the AutoRater.
New feature is the inclusion of a preview of how the rating will look in iTunes, ie the number of stars. iTunesRater0.6.zip (Note, this URL is broken for the time being, until I get around to uploading it to a site that can handle zip files, not just 3 types of image file…)