From 25c214f363811138cb0b66f130eeaf8861b4745a Mon Sep 17 00:00:00 2001 From: Evelyn Date: Sat, 29 Oct 2016 15:38:54 +0100 Subject: [PATCH] Force CRS to upper (Darwin doesn't like lowercase CRS codes) --- modules/nr.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/modules/nr.py b/modules/nr.py index 06c36f82..5ce1685a 100644 --- a/modules/nr.py +++ b/modules/nr.py @@ -34,7 +34,7 @@ class Module(object): def arrivals(self, event): token = self.bot.config["nre-api-key"] - crs = event["args_split"][0] + crs = event["args_split"][0].upper() client = Client(URL) @@ -52,9 +52,7 @@ class Module(object): "time" : self.span(query["generatedAt"], t["std"], t["etd"]), "dest_name": t["destination"][0][0]["locationName"], "dest_id": t["destination"][0][0]["crs"], -# "via": t["destination"][0][0]["via"], - "" - "via": "", + "via": '' if not "via" in t["destination"][0][0] else t["destination"][0][0]["via"], "platform": "?" if not "platform" in t else t["platform"] }) @@ -68,7 +66,7 @@ class Module(object): train_dest_plat.append((train["dest_name"] + train["via"], train["platform"])) trains_filtered.append(train) - trains_string = ", ".join(["%s (plat %s, %s)" % (t["dest_name"], t["platform"], t["time"], + trains_string = ", ".join(["%s %s (plat %s, %s)" % (t["dest_name"], t["via"], t["platform"], t["time"], ) for t in trains_filtered]) event["stdout"].write("%s (%s): %s" % (query["locationName"], crs,