From 267edd7c0b73a94dc7e85368802156208da466de Mon Sep 17 00:00:00 2001 From: Evelyn Date: Sat, 2 Sep 2017 12:37:08 +0100 Subject: [PATCH] NR: Allow displaying CRS only for arrivals/departures --- modules/nr.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/nr.py b/modules/nr.py index 7e875271..57568b41 100644 --- a/modules/nr.py +++ b/modules/nr.py @@ -141,6 +141,7 @@ class Module(object): "time": ("", lambda x: len(x)==4 and x.isdigit()), "tops": (None, lambda x: len(x)<4 and x.isdigit()), "power": (None, lambda x: x.upper() in ["EMU", "DMU", "HST", "D", "E"], lambda x: x.upper()), + "crs": (False, lambda x: type(x)==type(True)) }) if filter["errors"]: @@ -228,9 +229,9 @@ class Module(object): t["platform"], t["platform_prefix"] = summary_plat, "s" for t in trains: - t["dest_summary"] = "/".join(["%s%s" %(a["name"], " " + a["via"] + t["dest_summary"] = "/".join(["%s%s" %(a["code"]*filter["crs"] or a["name"], " " + a["via"] if a["via"] else '') for a in t["destinations"]]) - t["origin_summary"] = "/".join(["%s%s" %(a["name"], " " + a["via"] + t["origin_summary"] = "/".join(["%s%s" %(a["code"]*filter["crs"] or a["name"], " " + a["via"] if a["via"] else '') for a in t["origins"]]) trains = sorted(trains, key=lambda t: t["times"]["max_sched"]["ut"] if filter["type"]=="both" else t["times"]["st" + filter["type"][0]]["ut"])