From 5fda6e0efcee6b6834bae827c15f3ccb5f4eca85 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Thu, 29 May 2014 18:24:57 +0200 Subject: add support for N/S/E/W suffixes in the location MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/__main__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/__main__.py') diff --git a/src/__main__.py b/src/__main__.py index e0230c5..1fe2b50 100755 --- a/src/__main__.py +++ b/src/__main__.py @@ -314,7 +314,10 @@ def read_status(proc, sock): red_condition.acquire() try: if key == 'Location': - red_location = [float(v) for v in value.split(', ')] + def coordcomp(v): + v = (v + ' N').split(' ')[:2] + return float(v[0]) * (-1 if v[1] in 'SW' else 1) + red_location = [coordcomp(v) for v in value.split(', ')] # Followed by 'Temperatures' elif key == 'Temperatures': red_temperatures = [float(v.split(' ')[0][:-1]) for v in value.split(', ')] -- cgit v1.2.3-70-g09d2