Tuesday, November 01, 2005

Dog with a bone

On the day that I started this blog, back in June, I thought it would be cool to be able to display the currently playing iTunes track in my sidebar. Couldn’t imagine why anyone would be at all interested to know what I was listening to, especially as I buy all my music off the back of Uncut’s reviews, but since all the cool blog kids seemed to be doing it, I decided to follow the herd.

How hard could it be?

Six months of getting lost down countless spiraling hyperlink avenues, that’s how hard. There is apparently no way, no way, of doing this using:

a. a mac
b. Blogger

It should be simple. Extract the artwork of the currently playing iTunes track, and upload it to a web server. Yet only one piece of software claims to be able to upload album data to a web server. It’s called OnDeck and it’s a joke. It’s buggy, it crashes and its upload capability is a bag of shite, but since I’m no programmer and can’t do any better, I have to let it form the backbone of my attempt.

Now, the futility of my search bought to mind something else, so allow me to indulge for a moment. I love my Powerbook, I really do. It’s a joy to use, but I sometimes worry about the state of Mac software. Either an app is polished, beautiful and useless, or it’s in a perpetual beta state and not totally safe to use. One of the most useful pieces of software I run is called avidemux. I have a set-top DVD player that can play avi files, so that instead of having to watch everything I download on a crappy twelve inch screen, I can burn it to CD-RW and watch it on a much bigger telly. The only problem is that my DVD player can’t read avi files with packed bitstreams. In fact, this is a regular issue on set-top, avi playing, DVD machines. You’d think that by now someone would have come up with an easy way to unpack a video’s bitstream, but no. Why do anything so useful when instead we can be designing gorgeous widgets that count down to the next Stargate SG-1? Avidemux is a Unix app that will only run in the X11 environment. This is not right! Why hasn’t anyone Cocoa-fied it yet? Why hasn’t it been wrapped into ffmpegx (talking of perpetual betas). Can’t anyone else see the value of having this functionality natively?

No? Just me? Okay then.

So, iTunes display. It seems that I really should just be using Wordpress if I want to do this kind of thing.

However, since I quite like Blogger, and am frankly too ignorant to migrate everything to Wordpress, I thought I’d try another way.

Finally, today, I can at last unveil my barely satisfying solution.

So, if you too want an up to date visual record on your blogspot page of what’s playing in iTunes, you’re going to need OnDeck. You’ll also need Mac OSX 10.4, because my method here makes use of Automator.

First, create a folder in the Finder called “nowplaying;” we’ll call it that for now. You can change it later. Then open OnDeck, and from the preference window, select the publishing tab, and from the method selection in the artwork section, choose local. Almost every step from here on would be completely redundant if only you could select FTP and have it work. But I digress again. You’ll need the full Unix path of the nowplaying folder you just created in order to save to it - for instance: Volumes/Yourcomputer/Users/You/nowplaying/artwork.jpg.



Save your preferences, then from OnDeck’s Function menu, make sure that Publish Artwork is ticked.

Play something in iTunes, and make sure that the file artwork.jpg has been created in the nowplaying folder.

Go to Applications/AppleScript/Example Scripts/Folder Actions and run Enable Folder Actions.scpt

Download and install the Upload to FTP Automator action. Then create the following workflow (just drag these actions from the menu on the left to the pane on the right, in order):

• Get Specified Finder Items - select artwork.jpg
• Upload to FTP - fill in your FTP details
• repeat Get Specified Finder Items
• Move to Trash



Save the workflow as a plug-in; name it upload, set it as a plug-in for folder actions, and when prompted for a folder to associate it with, select nowplaying.



Manually delete the artwork.jpg already in nowplaying, and start using iTunes. From now on, whenever an album is changed, OnDeck will output the album’s artwork to nowplaying, and a script will run automatically, sending the jpeg to your webspace and then deleting it to make room for the next album. Tidy.

All you need to do now is edit your Blogger template, adding the source URL for your online image, and Bob’s yer uncle: everytime your blog is loaded, it will show the world whatever album you’re listening to, although God knows why you’d want it to do that. Just remember that you need to keep OnDeck running for this to work.

And that’s the best I could come up with, not having any programming skills of my own. It’s actually a pretty lousy solution because:

a. I can’t figure out how to upload and display track information, only artwork. You can choose for OnDeck to create a text file with the name of the Artist, Album, Track etc, but I’ve got no idea how to then get the info from that text file into my template, short of using the <object> tag, which is just ugly.
b. When your folder action kicks in, and your workflow starts to run, it actually hijacks your machine, making itself the frontmost application and kicking you out of whatever you’re doing. This is very annoying. I would suggest not doing this while listening to songs on shuffle.

And that brings my most recent obsession to an end, having neither the wit or the skill to take it any further for now. Having come this far on my own, I would gladly welcome any further advice, as I’m not particularly happy with the results so far. Yet despite its weaknesses I consider it one of the most satisfying displacement activities I've yet devised.

UPDATE (also posted above):

On the very day I posted my lengthy iTunes upload workaround, Apple go and release 10.4.3 which totally breaks it.

Specifically, “Get Specified Finder Items” no longer works as I like, and you can read more about what they’ve done to make it FUBAR at Mac OSX Hints.

In order to get the workflow to work correctly, by sending the uploaded files to the Trash so that your artwork folder can update, you have to perform some other action on your artwork.jpg first.

At first I tried labelling it, but that threw up an error, as did trying to rename it. In the end I settled for placing the “Move Finder Items” action just before “Move to Trash” and setting it so that artwork.jpg is moved to the Desktop before going in the Trash.

Idiotic.


Category: Meta

1 comment: