Archive

Posts Tagged ‘ruby’

Download all files in RSS feed using Ruby

April 24th, 2009 Jacken 3 comments

I’m working on learning Ruby on Rails and one great resource that I find myself going to is RailsCast. But as I really need to learn Ruby I wanted to write a quick program to download all the episodes to my harddisk and watch them using Plex Media Center. There’s probably a million different utilities (or podcast managers) that can do that, but using them I won’t learn to program Ruby that way. There’s probably a better way of doing this, but hey, do it and post a comment.

require 'rubygems'
require 'hpricot'
require 'open-uri'

doc = Hpricot.XML(open("http://feeds.feedburner.com/railscasts"))

(doc/"enclosure").each do |para|
  filename = File.basename(para[:url])
  puts "== Found a file #{filename}"
  open(filename,"w").write(open(para[:url]).read)
end
Categories: Programming Tags: ,

Yes, please apple, kill AppleScript

June 4th, 2008 Jacken No comments

Everytime (well, last night actually) when I need to do something with Applescript I shudder with horror. The syntax is actually something you forget all the time. There must be better alternatives for Apple to use as a scripting language. I agree with this article, but Python or Ruby would be a better alternative I think.

Categories: Programming Tags: , , , ,