Scripting

Tagging and iTunes: a roundup

As someone whose digital music collection keeps growing (now filling, despite my previous pledge, all but 15 GB on a 270 GB drive), I am always alert for new ways of managing the mountain of music. One trick that has been productive has been putting track metadata, including lists of musicians, actual recording dates, and keywords like “cover” or “remix,” in the Comments field of each track. This is a more staggering task than even I imagined, for a couple of reasons.

The first reason is the domain: even rock bands usually have north of four people involved in a given song, and when you look to jazz tracks, the task of manual data entry becomes huge. Also, unlike with iPhoto (or Flickr or del.icio.us), there is no concept of a discrete “tag” for a music track—in iTunes or anywhere else, as far as I can tell. Everything must live inside an unstructured comments field. So each item must be added manually, and God forbid you want to remove a tag from more than one item.

I had created an AppleScript to cope with the first challenge, a simple script that puts a user-defined keyword at the end of the comments block. But in a recent MacOSXHints article and its comments, I was exposed to a host of other solutions and am convinced it will be easier for me just to adopt someone else’s approach.

I’m tempted by the approach of managing iTunes tagging with Quicksilver, but I have actually given up using Quicksilver as it tends to slow to a crawl on my 1GHz G4 PowerBook. The approach of Common Tater looks good, but I’d rather have a small atomic script than a monolithic application, and it hasn’t been updated in quite a while. TuneTags has the same objection, plus the fact that its XML-like markup is too big to fit comfortably inside the meager 255 characters given for comments on a track.

I look forward to checking out Christopholis’s TuneTag (no relation) and the Add/Remove Tags scripts from dwipal. But ultimately the AppleScript solutions will need to yield to either a cross-platform iTunes plugin with a consistent tag separator methodology (semicolons? asterisks? XML? <T>?) or to a dedicated tag feature implemented by Apple. I’ve never understood why iTunes never got tags and iPhoto has had them since the beginning.

New iTunes script: Increment Playcount

I’ve uploaded a bare bones AppleScript that I’ve found useful over the past few weeks. The script, Increment Playcount, does what it says: it bumps the playcount of a track in iTunes by 1 and sets the Last Played date to the current date and time. It’s been helpful to me because many of my smart playlists rely on knowing if I’ve heard a track or not, but unfortunately sometimes my iPod doesn’t sync playcounts—and sometimes my iTunes library gets blown away, losing all playcount information.

To use the script, unzip it, drop the script in your Library/iTunes/Scripts folder, go to iTunes, select one or more tracks, then select Increment Playcount from the scripts menu.

More detail about this and my other AppleScripts on my Software page.

massDeleteManila: AppleScript for mass spam deletion

After the carpal tunnel moment earlier today, I decided to look on the bright side of spam. I updated my hoary old ManilaHandler AppleScript to add support for the Manila.message.delete method (and at the same time bundled the support script SOAPXMLRPCHandler into the body of the script). And I wrote a simple AppleScript, massDeleteManila, that takes a comma delimited list of message IDs and deletes them.

The UI isn’t elegant. You need to type or paste a comma delimited list into a dialog box. Plus no progress bar. But it works, and it is a lot faster than deleting spam through the web UI.

My suggested workflow for using this on your own Manila blog:

  1. Copy and paste the table for your discussion group topic listing page showing the spam messages into Excel.
  2. Copy just the message IDs and paste them into BBEdit (or another word processor).
  3. Search and replace: replace paragraphs with commas.
  4. Run the massDeleteManila script and paste the comma-delimited list of message IDs into the first dialog box.
  5. If you haven’t filled out your blog URL yet, type it in, along with your username and password.
  6. The script runs silently until all the messages have been deleted.

The massDeleteManila script is available for download. I provide it so that other Manila users, such as the Berkman bloggers, can benefit. Please use it carefully—there’s no easy way to undelete messages in Manila, and I cannot provide support if you accidentally delete important content. Note that you may need Tiger to run the script—I haven’t been able to test it under Panther.

In defense of plain ol’ SQL

Philip Greenspun Weblog: How long is the average Internet discussion forum posting?. I’m less interested in Philip’s answer than I am in the methodology: simple SQL select statements that give you very important product design data.

People talk about “data mining” and “business intelligence” as though they’re complicated, new skill sets, but really all you need sometimes to make the right call is a simple SQL query. And the right data set, of course…

Integrating Google Maps

Mac OS X Hints: Map Address Book addresses via Google Maps. This is the sort of low tech URL-based hack that is perfect for AppleScript, and very easy to debug.

An older Mac OS X Hints article discusses the plug-in capability and provides another sample script. From that, it looks like you capture the field to which you’re adding the contextual menu using an “on action property” handler; the title can be set with “on action title”; and the actual code is in the “on perform action” block.

Other address book plug-ins:

  • iCal Scripts (Apple): schedule a call, create a “birthday event” (reminder), or create an event associated with the person
  • Dates and SMS Scripts (Daniel Browne): send an SMS message via a Bluetooth phone, email, or AIM
  • Skype call (bertlmike): open a Skype call

The plug-ins can also be written in Cocoa or Carbon.

Last updated Friday, February 3, 2006 at 1:48:48 PM.

Here's the print-friendly version of this page.