Jon Aquino's Mental Garden

Engineering beautiful software jon aquino labs | personal blog

Saturday, February 19, 2005

Masterpiece Of The Day



I have created an RSS feed called Masterpiece Of The Day, showcasing a daily random masterwork painting from the ibiblio WebMuseum. I did this primarily to learn about some of the great artworks of history, and also to learn how to create an RSS feed. (Paul Graham would be proud!)

So what are you waiting for? Subscribe to it today using your RSS feedreader of choice! Here's the link to the feed:

Geek Notes

I use the following Ruby script to create the XML file, which gets FTP'd to the web on a daily basis. I love languages like Ruby that allow multi-line strings:

urls = File.readlines("motd.txt")
url = urls[rand(urls.size)].strip
url =~ /.*\/auth\/(.*).jpg/
rss = "<?xml version='1.0'?>
<rss version='0.91'>
<channel>
<title>Masterpiece of the Day</title>
<link>http://jonaquino.blogspot.com/2005/02/masterpiece-of-day.html</link>
<description>A daily random masterwork painting from the ibiblio WebMuseum.</description>
<item>
<title>#{$1}</title>
<link>#{url}</link>
<description>&lt;img src='#{url}'&gt;</description>
</item>
</channel>
</rss>"
File.open("motd.xml", "w") {|file|
file.write(rss)
}
puts `ftp -i -n -s:"motd.ftp"`

2 Comments:

Post a Comment

<< Home