Created
July 24, 2008 16:38
-
-
Save mattb/2214 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'fireeagle' | |
require 'twitter' | |
# get yourself an access token by hand on the irb commandline with the oauth gem | |
fe = FireEagle::Client.new(:consumer_key => "<yourkey>", :consumer_secret => "<yoursecret>", :access_token => "<youraccesstoken>", :access_token_secret => "<youraccesstokensecret>") | |
t=Twitter::Base.new "<yournick>","<yourpassword>" | |
lat = nil | |
lng = nil | |
while true | |
puts "Checking twitter" | |
if t.user('mattb').location.match(/([\-0-9.]+),([\-0-9.]+)/) | |
newlat = $1 | |
newlng = $2 | |
if newlat != lat or newlng != lng | |
lat = newlat | |
lng = newlng | |
rsp = fe.update(:lat => $1, :lon => $2) | |
if rsp.success? | |
puts "Successful update to #{lat}, #{lng}." | |
# specially for rabble, overwrite the "iPhone: lat,lng" with Fire Eagle's human-readable best guess. | |
t.update_location(fe.user.best_guess.to_s) | |
end | |
end | |
end | |
sleep 60*5 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment