Creating a Photo Album in Facebook from Smalltalk
After I uploaded some photos to Facebook earlier using iPhoto, I decided to see how hard the same operation would be from Smalltalk. Here's the code:
"Create an album, upload to it" album := PhotoAlbum new. album name: 'Annapolis Coulton Concert'. album location: 'Annapolis, MD'. album description: 'Jonathan Coulton concert with Paul and Storm at the RamsHead in Annapolis, MD'. album visible: 'friends'. returnAlbum := connection photosCreateAlbum: album. returnAlbum := aPhotoAlbum dir := '../images/coulton'. files := dir asFilename directoryContents. photos := files collect: [:each | | photo | photo := PhotoUpload new. photo caption: 'Coulton Concert in Annapolis'. photo aid: returnAlbum aid. photo filename: (dir asFilename construct: each) asString]. answers := connection photosUploadMultiple: photos.
You can see how wrapping a small UI on that would be pretty simple. Heck, most of the code is just creating the domain objects that are required for the calls :) The code is all in the public store, in FacebookBundle
Technorati Tags: facebook, social media

