Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > A success story

Thread Tools

A success story

Gregory Seidman
Posts: n/a
No, this isn't some story about a successful enterprise-level
intranet/extranet web portal solution done entirely in Ruby (and Rails).
This is just a story of quick success in doing a simple task.

Problem: I wanted to create images of a web-suitable size from the images
in one of my wife's iPhoto albums without taking over my wife's
computer (e.g. VNC over ssh to take control) since she was using
it at the time.


% sudo gem install -r -y iphoto2

Ruby script (listalbum):

#!/usr/bin/env ruby

require 'rubygems'
require 'iphoto2'

if ARGV.length == 1
data =[0])
data.albums.each { |a| puts }
elsif ARGV.length == 2
data =[0])
album = { |a| == ARGV[1] }
fail "Could not find an album named '#{ARGV[1]}'" unless album.length == 1
album = album[0]
album.images.each { |img| puts img.path }
fail "Usage: #{__FILE__} <AlbumData.xml> [album name]"

% mkdir /tmp/pics
% listalbum AlbumData.xml 'Our Cats' | tr '\012' '\000' | xargs -0 -Jx cp x /tmp/pics
% mogrify -resize '1024>' /tmp/pics/*


So yeah, I'm pleased. Mainly I'm pleased that the iphoto2 gem exists and
Just Works, but I'm pleased with how easily I did all this. I neglected to
mention that this mostly (the listalbum and the mogrify) happened on a
Linux box, and the Mac just supplied the AlbumData.xml and JPG files.


Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Not-A-Duck, In the Rain - Quite a Success Story RichA Digital Photography 30 09-08-2010 04:28 AM
Author of a Python Success Story Needs a Job! Andrew Jonathan Fine Python 27 01-15-2010 11:59 AM
YASS (Yet Another Success Story) k3xji Python 1 06-27-2009 08:31 AM
python success story Max M. Stalnaker Python 3 01-30-2006 02:36 PM
Asterisk semi-success story: cheap FXO gateway Peter VOIP 4 07-08-2003 10:48 AM