Ann Arbor Parking Information by Phone – an Adhearsion Example

2009 January 30
by jasongoecke

dda_logo.jpg

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:

#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

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:

Picture 1.png

With the wealth of data and APIs available on the internets coupled with Adhearsion, developing voice mashups just got a lot easier.

No comments yet

Leave a Reply

Note: You can use basic XHTML in your comments. Your email address will never be published.

Subscribe to this comment feed via RSS