
The XML-RPC calls work as described by the documentation and examples, but they make no mention of what to do if you need to send Base64 dataFor a while it looked like I might actually be able to consolidate my current Rube Goldberg iPhoto to Movable Type solution into a single AppleScript, thanks to OS X's AppleScript Support for Remote Procedure Calls.
The XML-RPC calls work as described by the documentation and examples, but they make no mention of what to do if you need to send Base64 data; in my own tests of the Movable Type metaWeblog.newMediaObject method, a base64 encoded string simply gets handled as a plain text string on the other side, and gets written directly to the file.
On a hunch I tried passing the raw file data as an AppleScript data variable, hoping against hope that the Apple Event handler would take care of the encoding on the fly, but as far as I can tell the raw data also gets passed along as a string, leading to a munged XML-RPC message.
And naturally, there's absolutely nothing out there on the web or usenet regarding this issue... I can't believe I'm the first person to try this, but perhaps those before me have given up in disgust before getting as far as writing about it.
I dropped the good folks at developer.apple.com a note regarding the documentation, politely suggesting that some clarification would be very helpful.. we'll see what happens.
In the meantime, I may as well make the XML-RPC call via PHP with a do shell script statement.
If anyone who comes across this has a solution, I would be most grateful if you could drop me a line with a quick code snippet.
In my ongoing attempt to perfect my iPhoto to Movable Type solution, I ran into the need to convert a Unix path (/tmp/foo.jpg) into an HFS style path (Mac HD:tmp:foo.jpg) that plays nicely with AppleScript's 'read' command.
Apparently this isn't all that common an issue, since file paths tend to be grabbed programmatically by AppleScript... but because I'm doing stuff with shell commands I'm working with Unix paths.
After much Googling, I found my answer in the first comment of a post on macosxhints.com.
In a nutshell, to convert a string representing a Unix file path into an HFS file path, do like so:
posix file "/path/to/my/file.txt"
This is probably not news to anybody who actually knows AppleScript, but I'm still stumbling my way along, grabbing other people's code and making educated guesses. The plain English style syntax is disconcerting.
If you're doing any parsing on the 'image_date' field as grabbed by AppleScript, beware.I just noticed a strange thing about the iPhoto 2.0 date/time field - if you don't touch the date set by iPhoto on import, AppleScript will read the date in the format 'YYYY:MM:DD HH:MM:SS'.
If you go in and tweak the date manually, however, AppleScript reads the date in the format 'YYYY-MM-DD HH:MM:SS -XXXX' where XXXX is the GMT offset. (note the hyphens between Y/M/D, compared to the colons above.)
So, if you're doing any parsing on the 'image_date' field as grabbed by AppleScript, this will probably give you grief.
I just added about 70 photos to the site. These were all available on the site I began in September of 2001, and sort of disappeared sometime during the spring of 2002.
The earliest photo at the time of this writing was taken on 9/26/1999, an astonishing 4.25 years ago.
Having added the photos to Movable Type using the dates upon which they were taken, the archives now go all the way back to 9/1999, which is somewhat mind-blowing to me.
When I started spending the occasional Saturday or Sunday driving around Los Angeles and taking photos, I had vague aspirations of creating a site like the excellent Roadside Peek, but again and again the prospect of managing such a site statically was just too much of a downer for me to ever make a serious effort. By late 1999 I had come to the conclusion that managing content-oriented websites with static HTML pages was a losing proposition, but lacking PHP and database knowledge at the time I didn't know what to do about it.
So the photos accumulated... first on Zip disks and then on CD-ROMs. Some of the backlog made it onto my 2001 web site, but many, many more photos remain scattered across those old CD's.
Enter iPhoto - A great tool for organizing groups of photos, and Movable Type - a great tool for putting content online. Connectivity between the two is still lacking, but I feel like a solution is in sight, and it will probably involve some combination of AppleScript, ImageMagick and PHP. My holy grail is to manage photographs in iPhoto - import them, label them, add comments, and then run an automated process to take that information from iPhoto, resize the photos for web use, build Movable Type Entry and Excerpt HTML, and push it all to the webserver.
Eric Sigler's jaw-dropping iPhoto2Weblog plugin comes so close, but the current release doesn't quite give me the flexibility I want.
Nevertheless, this is exciting stuff that I couldn't have imagined getting my hands on when I got my Olympus digicam back in 1999. Who knows what this site will look like by the end of 2004?
I recall that posting photos was the perfect activity for when I didn't feel like writing, but wanted to add something to the site... so there's no reason I shouldn't get back into that habit as well.One thing that still bugs me about Movable Type, and Blog-related, web-based CMS in general, is the lack of good, native support for photo management.