Created
February 17, 2010 08:18
-
-
Save jpf/306426 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'xmlsimple' | |
require 'open-uri' | |
require 'sinatra' | |
url = 'http://www.dnalounge.com/calendar/dnalounge.rss' | |
c = '' | |
c = c + "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" | |
c = c + "<Response>\n" | |
doc = XmlSimple.xml_in(open(url).read) | |
doc['channel'][0]['item'].each do |item| | |
date = Date.parse(item['date'][0]) | |
age = item['age'][0] + ' and up' unless item['age'][0] == 'all ages' | |
[date.strftime('%A, %B %e'),item['title'][1].sub('&','and'),item['time'][0].sub('-','until'),age].each do |line| | |
c = c + " <Say>%s</Say>\n" % line | |
end | |
end | |
c = c + "</Response>\n" | |
post '/' do | |
response.headers['Content-Type'] = 'text/xml' | |
c #alendar | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment