Automating Location-Triggered Podcasts
In No Agenda's (really, Comic Strip Blogger seems to differ) 31st episode, Adam told John that he would like to do a location-specific podcast, which would play when user arrives at a certain location. Comic Strip Blogger, who, like me, never uses his real name when on the DSC, observes that this is nothing new. Indeed, CSB, how about you point us to a project that accomplishes this task (like this entry :), for example ). There are a number of pseudostandards. Within an item, you'll need to add an enclosure, and the geocode (using the simple format, example below).
Saved as rss.xml
-
Today: 0730 Zimbabwe 24 June 08
The UN Security Council declaration on Zimbabwe represents a significant move in the diplomatic pressure on Robert Mugabe. Everyone agreed that the violence there makes it impossible to hold free and fair elections at the moment. But what are the diplomatic prospects? The former leader of the Liberal Democrats, Lord Ashdown, considers what would work.
The UN Security Council declaration on Zimbabwe represents a significant move in the diplomatic pressure on Robert Mugabe. Everyone agreed that the violence there makes it impossible to hold free and fair elections at the moment. But what are the...
The UN Security Council declaration on Zimbabwe represents a significant move in the diplomatic pressure on Robert Mugabe. Everyone agreed that the violence there makes it impossible to hold free and fair elections at the moment. But what are the diplomatic prospects? The former leader of the Liberal Democrats, Lord Ashdown, considers what would work.
Tue, 24 Jun 2008 07:30:00 +0100
8:25
http://downloads.bbc.co.uk/podcasts/radio4/today/today_20080624-0730.mp3 http://downloads.bbc.co.uk/podcasts/radio4/today/today_20080624-0730.mp3
BBC Radio 4
-17.515 31.147
def reactToLocation(location = '-17.515 31.147'):
import feedparser
f=feedparser.parse('rss.xml')
for item in f.entries:
loc = item['georss:point']
if loc == location:
import urllib2, urlparse
parsed = urlparse.parse (item['enclosures'][0]['href'])
data = urllib2.urlopen(item['enclosures'][0]['href']).read()
file = open(parsed[2].split('/')[-1], 'w')
file.write(data)
# open the file in your mp3 player and listen
return True
