Skip to content

Instantly share code, notes, and snippets.

@mataki
Created September 9, 2010 11:28
Show Gist options
  • Save mataki/571748 to your computer and use it in GitHub Desktop.
Save mataki/571748 to your computer and use it in GitHub Desktop.
require "rubygems"
require "pivotal_tracker"
require "rest_client"
pt = PivotalTracker::Client.token = ""
fetched_occurred_at = nil
def speach(text)
resp = RestClient.get "http://translate.google.com/translate_tts?tl=en&q=#{URI.escape(text)}"
t = Tempfile.new "gtts"
t.puts(resp.body)
t.size
system("afplay #{t.path} > /dev/null 2>&1")
t.close(true)
rescue => e
puts "[Error] #{e}"
end
def ring
system('afplay ~/.git/happykids.wav > /dev/null 2>&1')
rescue => e
puts "[Error] #{e}"
end
loop do
activities = PivotalTracker::Activity.all
new_activities = fetched_occurred_at ? activities.select{ |i| i.occurred_at > fetched_occurred_at } : activities
new_activities.select{ |a| a.description =~ /(finished|accepted)/}.each do |activity|
puts activity.description
speach(activity.description)
ring
end
fetched_occurred_at = activities.first.occurred_at
sleep(60)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment