technology

Re-Writing Dave Winer’s “Revolution” in a few lines of Ruby

It’s been about time. Too much time has gone by since the last Dave Winer revolution - him being the inventor of RSS and Weblogs and all.

So it was with no small excitement that I dove deep into his newest project, FlickrFan, a “platform” to turn your flickr feed into a screensaver.

Nevermind that we already have something like this - Adriaan Tijseling’s 1001 - which not only comes with said “Pictures to Screensaver” ability, but also uploads images to Flickr, and much nicer than iPhoto at that, notifies me when my friends post new images, and lets me declare arbitrary search sets to stream onto my desktop.

So I download FlickrFan. And, at first, I am a bit confused. “OPML.dmg”? Unpacks into an “OPML.app”? Could Mr. Winer just have taken his former software, that OPML editor very few people actually used, and added a small RSS parser and enclosure downloader? “Naaah!”, I think. But, alas, it seems that way. That web server on localhost? We know it well from Radio. Half a haphazardly uncentered background image and a crapjob HTML page later, it dawns…

… I wrote that software about six months ago, myself. Here it is, for all y’alls to peruse, critique, change, laugh about, and tell me how much I suck for writing it:

#!/usr/bin/ruby
 
require 'rss'
require 'net/http'
require 'uri'
 
MYUSER = "35034355182@N01" 
# change this to your user-ID on flickr. The easiest way is to look at your RSS feed from your photos page.
 
rss = RSS::Parser.parse(open('http://api.flickr.com/services/feeds/photos_public.gne?id='+MYUSER+'&lang=en-us&format=rss_200').read, false)
 
rss.items.each { |i|
  uri = i.description[/http:\/\/farm.\.static\.flickr\.com\/[^\"]*/]
  print uri
  url = URI.parse(uri.sub("_m", ""))
  Net::HTTP.start(url.host, url.port) { |http|
    res = http.get(url.path)
    open(i.link[/[0-9]+/]+".jpg", "wb") { |file|
      file.write(res.body)
    }
  }
}

This will download your latest images into the current folder. Now for the magic - let’s add a cronjob and move the file. We could do this with a handful of complicated maneuvers, but the easiest (and even Dave Winer insists, it should be simple) way is to name this file something like “fluckr” (it’s what I named it, duh), do a “chmod +x fluckr && mv fluckr /usr/bin”, and then edit cron…

type “crontab -e”, then paste this:

5 0 * * *       cd /Users/YOURUSERNAME/Pictures/Screensaver && /usr/bin/fluckr

this will get your new images every day, 5 minutes after midnight. “*” means “every”, so you could do a

5 * * * *       cd /Users/YOURUSERNAME/Pictures/Screensaver && /usr/bin/fluckr

to get your images every hour at five past. Or do a

0 6,9,12,15,16 * * *       cd /Users/YOURUSERNAME/Pictures/Screensaver && /usr/bin/fluckr

to get it them during working hours every 3 hours by the hour.

Alas, two things remain to be done. First, create a directory called “Screensaver” under the “Pictures” folder in your home directory. Secondly, configure your screensaver by opening the Screensaver preferences pane and selecting “Choose Folder”. Choose the one you just created, and test the whole thing via a commandline test:

cd /Users/YOURUSERNAME/Pictures/Screensaver && /usr/bin/fluckr

done. See, writing this entry took me longer than to write the code and to make that directory. Sure, there’s no error checking (simple), no tag or random or “my friends” support (simple), and there’s no end to how many images it will suck into that folder (simple, just limit the folder, make a backup based on year/month or so, move old stuff, download new stuff), but those are literally the fruits of half an hour of labor. Oh, and - yes - it’s running on my Mac Mini which serves as a home automation and DVR device. Been running there since March when I wrote this thing. Revolution? Hmmm!

Om, one of the good guys, says it’s “understandable that some are underwhelmed” but he likes the concept. Which he had in our hands, be it via 12 lines of Ruby or Adriaan’s 1001, for years now. And if that’s not enough, read Rob Hyndman.

Here’s where my beef is. My beef isn’t with Dave. He’s a coder, if he wants to write yet another Flickr Slideshow maker, more power to him. It’s not like any of us have sailed exclusively on novel, powerful, ideas. My beef isn’t with the whole OPML.app and shabby looks and memory leaking web server on localhost. Really, it isn’t. I don’t have to use it, and I won’t, so it’s no harm and no foul, right?

What irks me, is the echo chamber. As usual, I dare add. Some call it “The Next Internet Platform”, some talk about, how “the service leverages a number of APIs to do some very cool things”. It’s a fecking RSS downloader and/or simple FlickrAPI caller. My sixteen year old niece, no joke, does precisely that as a science project. Her Python program aggregates all the “in” sites via various APIs and RSS readers, and sends her an email every morning. If she can do it, anyone can.

Robert Scoble calls it a Revolution. That one’s funny. I am not quite sure what it’s supposed to revolutionize and why precisely it’s revolutionary as opposed to 1001, which is - I guess - merely “really cool”, but the latter runs well on Mac Minis since there were Mac Minis, so I might just be dulled by years of using my DVR for precisely that task already.

Oh, and then there’s Mashable. Guess I am not that alone with my sentiments.

Popularity: 42%

Discussion

for “Re-Writing Dave Winer’s “Revolution” in a few lines of Ruby”