diff options
| author | 2017-09-02 12:37:08 +0100 | |
|---|---|---|
| committer | 2017-09-02 12:37:08 +0100 | |
| commit | 267edd7c0b73a94dc7e85368802156208da466de (patch) | |
| tree | 64a6efdbc9a50e3dbb43a486bce2ef05f86a6ffa | |
| parent | NR: Support Eagle API keys, don't assume platforms are available (diff) | |
| signature | ||
NR: Allow displaying CRS only for arrivals/departures
| -rw-r--r-- | modules/nr.py | 5 |
1 files 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"]) |
