Merge lp:~jpg0/eyefi/update-geolocate into lp:eyefi

Proposed by Jonathan Gilbert
Status: Merged
Merged at revision: 40
Proposed branch: lp:~jpg0/eyefi/update-geolocate
Merge into: lp:eyefi
Diff against target: 35 lines (+7/-4)
2 files modified
eyefi/actions.py (+1/-1)
eyefi/google_loc.py (+6/-3)
To merge this branch: bzr merge lp:~jpg0/eyefi/update-geolocate
Reviewer Review Type Date Requested Status
Robert Jordens Pending
Review via email: mp+144472@code.launchpad.net

Description of the change

Fixed Google Geolocation API access

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'eyefi/actions.py'
2--- eyefi/actions.py 2012-11-03 20:33:13 +0000
3+++ eyefi/actions.py 2013-01-23 10:50:44 +0000
4@@ -125,7 +125,7 @@
5 if sidecar or photo.lower().endswith(".jpg"):
6 loc = loc["location"]
7 write_gps(photo,
8- loc["latitude"], loc["longitude"], loc.get("altitude", None),
9+ loc["lat"], loc["lng"], loc.get("alt", None),
10 "WGS-84", loc.get("accuracy", None), sidecar, xmp)
11 return loc, photo
12
13
14=== modified file 'eyefi/google_loc.py'
15--- eyefi/google_loc.py 2012-11-03 20:33:13 +0000
16+++ eyefi/google_loc.py 2013-01-23 10:50:44 +0000
17@@ -30,12 +30,15 @@
18 """
19 base = {"wifiAccessPoints": [],}
20 for mac in macs:
21- base["wifiAccessPoints"].append({"macAddress": mac})
22- d = getPage("%s?key=%s" % (LOC_BASE_URL, key), method="POST",
23- postdata=simplejson.dumps(base))
24+ base["wifiAccessPoints"].append(format_mac(mac))
25+ d = getPage(str("%s?key=%s" % (LOC_BASE_URL, key)), method="POST",
26+ postdata=str(simplejson.dumps(base)), headers={"Content-Type": "application/json"})
27 d.addCallback(simplejson.loads)
28 return d
29
30+def format_mac(mac):
31+ return {"macAddress": mac["mac_address"], "age": mac["age"], "signalToNoiseRatio": mac["signal_to_noise"]}
32+
33 def main():
34 from twisted.internet import reactor
35 from twisted.python import log

Subscribers

People subscribed via source and target branches