View Single Post
Posts: 214 | Thanked: 140 times | Joined on Aug 2010
#214
Ok, there has been some requests for "latitude only" stuff, and not my whole "app".... find that part attached.

Let me explain the story.

Obviously, me posting my whole app as a "small modification to the script" was, of course, a bit of a joke. I'm a comedian like that, and anyone who knows my dry humor would attest to this


What REALLY happened: I had been playing with my app for QUITE some time, as a personal tool to check in to multiple locations. I hadn't combined it with Latitude, nor did I have have an automatic update daemon yet.


When I was playing with this update script, I realized that (some of) that code also applied to my app... and.... that with some sugar and spice, it could almost become a useable app, that I release!


So I decided to package up the app, and as a bit of a joke, post it here as if "oh by the way, I made a small modification to the script", and hilarity would ensue as I had undersold and overdelivered.

All that was thwarted by my screwed up packaging, and the joke went stale and unfunny. *badoom-not-psssh*... oh well :/ Sorry.


So - if you are interested in anything MORE than just Latitude, I still recommend you try out "ZapLoc" (you are welcome in the ZapLoc thread for that).


However, several people were only really interested in the "smarter updating of latitude" but ONLY, so that code is attached here:


This script is DIFFERENT than before. Gone are the "--once" option. Gone is the idea to start it from "Alarmed". Instead, this code will - after receiving a "good enough" GPS sample - sleep the GPS (turn it off, basically, not consuming any power) for a set number of minutes, and then turn it on again. Basically, the app is doing nothing consuming zero CPU for this time, and then turns back on and gets a GPS sample again after some minutes.

How many minutes of what, you can set yourself in the variables with upper-case names in the beginning of the file, here:

PHP Code:
EPS               0.001  # Points within this many degrees are considered "same" and not sent
UPDATE_AT_MOST    1      # NEVER update more than this (minutes) even when moving
UPDATE_AT_LEAST   60     # NEVER update LESS than this (minutes) even when still (to avoid "stale points" in Latitude)
GPS_INTERVAL      5      # How often to "awaken" the GPS (minutes) 
ALSO, the script still requires the google api, but I have made a package of that, in extras/devel you can be root and do

Code:
apt-get install google-api-python-client
...to get that to happen.

Enjoy.

Or not.

/Z
Attached Files
File Type: zip zaps-new-latitude-updater.zip (3.4 KB, 233 views)

Last edited by MasterZap; 2011-05-16 at 05:45.
 

The Following 3 Users Say Thank You to MasterZap For This Useful Post: