Automatic check-in of Google Latitude position to Brightkite – now less stupid !
Tired of waiting for Google to release a proper Latitude API, I went ahead and scribbled latitude2brightkite.sh – a script that checks-in your Google Latitude position to Brightkite using the Brightkite REST API and the Google Public Location Badge. See my seminal post from yesterday for more information about how I cobbled it together.
Since yesterday I cleaned it up a little, but most of all, as promised, I made it more intelligent by having it compare the current position with the last one, in order to check-in with Brightkite only if the Google Latitude position has changed. Not checking-in at each invocation will certainly reduce the number of check-ins by 99% – and I’m sure that Brightkite will be thankful for the lesser load on their HTTP servers…
So grab the code for latitude2brightkite.sh, put it in your crontab and have more fun with Brightkite and Google Latitude !
There is quite a bit of interest for this script – it seems that I have filled a widely felt need.
7 responses to “Automatic check-in of Google Latitude position to Brightkite – now less stupid !”
Leave a Reply
You must be logged in to post a comment.
Congrats on the script which works like a charm. Looking at http://brightkite.com/people/inliner/friendstream with things like:
inliner checked in @ Bagneux, Île-de-France, France – 1 minute ago
inliner checked in @ Bagneux, Île-de-France, France – 8 minutes ago
inliner checked in @ Bagneux, Île-de-France, France – about 1 hour ago
inliner checked in @ Bagneux, Île-de-France, France – about 2 hours ago
and the equivalent for user liotier, I thought I’d give a try replacing:
place=`wget -qO- “http://brightkite.com/places/search.xml?q=$latitude%2C$longitude” | grep “” | sed s/\ \ \// | sed s/\
//`
by:
id=`wget -qO- “http://brightkite.com/places/search.xml?q=$latitude%2C$longitude” | grep “” | sed s/\ \ \// | sed s/\
//`
place=`wget -qO- “http://brightkite.com/places/search.xml?q=$latitude%2C$longitude” | grep “” | sed s/\ \ \// |
sed s/\//`
and:
curl -X POST -u $YourBrightkiteLogin:$YourBrightkitePassword http://brightkite.com/places/$place/checkins.xml
by:
curl -X POST -u $YourBrightkiteLogin:$YourBrightkitePassword http://brightkite.com/places/$id/checkins.xml
In short, I’m now only posting the updates if the _name_ of the location changes, not if only the _internal BK id_ of the place does. Let me know what you think Jim.
Sounds like a great idea for smoothing sampling noise and only react to significant changes.
But in your proposal, there is a “place=” line which is the same as mine – isn’t that an error ?
ah… wordpress censored useful elements of the script I think. sorry about this. Here’s a link to the modified script: http://ylj.biz/latitude2brightkite.sh.txt
Very nice ! I’ll publish it at the original script’s location.
Google Latitude Brightkite check-in script updated to version 0.5…
I just released a new update of latitude2brightkite.sh – a script that checks-in your Google Latitude position to Brightkite using the Brightkite REST API and the Google Public Location Badge.
The changes are :
20090607 – 0.3 – The working directory i…
Done.
Hi, cool script, I was going to suggest something like this at Brightkite and found yours. BTW, I am not sure on how to install it. I’d like to pull my Latitude location to BK when I access Google Maps with my mobile phone (Symbian S60).
Thanks