iTunesRater 0.3

Okay, notification is a breeze. iTunesRater now has two new features:

  1. Doesn’t poll, waits for notification from iTunes (requires 4.7.1)
  2. Volume Adjustment

Instead of polling iTunes every 5 seconds, the information is only checked when iTunes sends a general notification to the NotificationCenter. This should mean less CPU use, not that I was using much anyway. To get this to work well, I had to notify the AppleScript that a change had been made, by ‘pressing’ one of the interface items. Slightly unorthodox, but effective. Also, a few of my CDs are softer than the rest, I now have a volume adjustment slider on the left hand side that can be used to modify the volume of the current track - don’t use this as your master iTunes volume, it writes the data into your library, so that track will become louder or softer each time you play it. I might actually make this into a fully-fledged iTunes Controller, with AutoRating features. Later. Time to sleep.

iTunesRater 0.1

As much as I like to bitch and moan about AppleScript, AppleScriptStudio isn’t too bad for creating simple applications. In a couple of hours, I just wrote a simple stand-alone application that monitors the current song playing in iTunes, and allows rating to occur, independent of the iTunes window. It also allows for a larger range of values as the rating, rather than the iTunes 0-5 stars. The tick marks are on the slider so you can see what the current rating will be in terms of the iTunes display. Features:

  • Automatically updates display from iTunes when song changes
  • Automatically updates iTunes rating whenever it’s changed
  • Allows for more flexible rating than basic iTunes, and most other programs capable of changing ratings.
  • Unobtrusive, can sit in the corner of the screen while working.

Limitations:

  • Ugly icon

I take no responsibility if this toasts your iTunes library - I use it with mine, but your mileage may vary. Here’s a little screenshot, and the archive is iTunes Rater. (Only Version 0.2 is still available!) Itunesrater The AppleScript code is IMHO interesting:

iTunesRater 0.6

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…)

iTunesRater Bug

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…

iTunesRater & Artwork Finder

Thanks to Sam Deane, and his Now Playing script, I have added the following functionality to iTunesRater. When a song with no Artwork starts playing, Amazon.com is contacted, and if the Artwork is available, then a drawer with possible artworks is opened. Eventually, when you click the Artwork you want, it will be copied to the track, (and all others from the same album). Now if only I can make it so it does this bit in the background - perhaps another script that gets called?

Ratings on the Fly

So far, the program I’ve written does this: Monitor the current track, and how much of it has been played. Wait for a click on the Next (» ) button, and when it occurs, rate the song up or down according to the modifier: abs((amount played / song length) * 15) - 5 Thus, when a song is skipped immediately, it loses 5 rating points, songs that are clicked at the end receive a +10 modifier. The only problem is that this is only triggered when this program wants the next track. I need a robust method of…I’ve just thought of something. I’m getting close to getting this to work - when the song is changed, the track id is used to find the song in the library, and the last known rating modifier will be applied to the song’s rating. It just doesn’t do that yet!

Memory Leak

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!

Preferences for iTunesRater

I’m working on saved preferences for iTunesRater, after a timely hint on macosxhints.com about Applescript Studio and preferences. The program will load them fine, but just doesn’t seem to save them. Too tired now to care.

iTunesRater Rewrite Planned

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 0.7

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.