Sometimes you need a distraction from what you are doing. That's why I wrote this quick little script today. It's a python program to download rss (and other) feeds and place them in your iPod's Notes folder.
#!/usr/bin/python
import os
from urllib2 import *
# download mark pilgrim's feedparser.py
# and execute it in here
feedparser = urlopen("http://flyingmeat.com/x/feedparser.py")
exec(feedparser.read())
def getIpod():
files = os.listdir('/Volumes/')
for file in files:
if os.path.isdir('/Volumes/' + file):
mightPod = os.listdir('/Volumes/' + file)
for ipc in mightPod:
if ipc == "iPod_Control":
return '/Volumes/' + file
return None
def feedToPod(url):
data = parse(url)
feedDir = getIpod() + "/Notes/_rss/" + data['channel']['title']
if not os.path.exists(feedDir):
os.makedirs(feedDir)
i = 1
for item in data['items']:
page = item['title'] + "\n" + item['description']
front = str(i)
if (i < 10):
front = "0" + front
open(feedDir + "/" + front + ". " + item['title'], 'w').write(page)
i = i + 1
feedToPod('http://flyingmeat.com/journal/rss.xml')
feedToPod('http://diveintomark.org/xml/rss.xml')
You can stick that script in a page (called "rss2pod" or something) in VoodooPad, and hit command-R to run it. There are probably tons of ways to improve this, like not downloading the Feed Parser module every time), but it was just a quick exercise.
Thanks to