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'>
<title>Masterpiece of the Day</title>
<description>A daily random masterwork painting from the ibiblio WebMuseum.</description>
<description>&lt;img src='#{url}'&gt;</description>
</rss>""motd.xml", "w") {|file|
puts `ftp -i -n -s:"motd.ftp"`


Post a Comment

<< Home