Ann Arbor Parking Information by Phone - an Adhearsion Example

Media_httpjsgoeckefil_kjmqy
Recently I was inspired by a post to develop a phone app that could playback information scraped from a website. The folks in Ann Arbor, MI have created a webpage that displays, in HTML, the number of spaces currently available in their 9 downtown lots. Using Hpricot I was able to fetch the webpage and then parse out the appropriate data as follows: [sourcecode language='ruby'] #Fetch the available parking spaces by scraping the Ann Arbor website def fetch_available_spaces doc = Hpricot(url) parking_spaces = Array.new cnt = 0 (doc/"td").each do |row| if row.inner_text =~ /\.{28}/ parking_spaces[cnt].merge!( { :spaces => row.inner_text.gsub("............................ ", "") } ) cnt += 1 else parking_spaces[cnt] = { :name => row.inner_text } end end return parking_spaces end [/sourcecode] Then using the open source Text to Speech engine (TTS) Festival, I was able to create a menu that played back all of the available parking spaces in each lot to a caller. This work resulted in an Adhearsion Component which I then posted on GitHub as a working example app:
Media_httpjsgoeckefil_dsjeb
With the wealth of data and APIs available on the internets coupled with Adhearsion, developing voice mashups just got a lot easier.
Posted