diff options
| author | 2017-08-27 14:41:11 +0100 | |
|---|---|---|
| committer | 2017-08-27 14:41:11 +0100 | |
| commit | f6766ae4778889d0f70a8dafaa1547dfe88fa8f3 (patch) | |
| tree | a54464fdb812517551e987c5ea4d1f9338ee57a6 /modules/nr.py | |
| parent | Signals: add quote (diff) | |
| signature | ||
Implement 'time' parameter
Diffstat (limited to 'modules/nr.py')
| -rw-r--r-- | modules/nr.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/modules/nr.py b/modules/nr.py index b44d4d1f..f487ff06 100644 --- a/modules/nr.py +++ b/modules/nr.py @@ -138,7 +138,7 @@ class Module(object): "terminating": (False, lambda x: type(x)==type(True)), "period": (120, lambda x: x.isdigit() and 1 <= int(x) <= 240, lambda x: int(x)), "nonpassenger": (False, lambda x: type(x)==type(True)), - "timebase": ("0000", lambda x: len(x)==4 and x.isdigit()), + "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"], lambda x: x.upper()), }) @@ -152,9 +152,14 @@ class Module(object): nr_filterlist = client.factory.create("filterList") if filter["inter"]: nr_filterlist.crs.append(filter["inter"]) + now = datetime.now() + if filter["time"]: + now = now.replace(hour=int(filter["time"][:2])) + now = now.replace(minute=int(filter["time"][2:])) + method = client.service.GetArrivalDepartureBoardByCRS if len(location_code) == 3 else client.service.GetArrivalDepartureBoardByTIPLOC try: - query = method(100, location_code, datetime.now().isoformat().split(".")[0], filter["period"], + query = method(100, location_code, now.isoformat().split(".")[0], filter["period"], nr_filterlist, "to", '', "PBS", filter["nonpassenger"]) except WebFault as detail: if str(detail) == "Server raised fault: 'Invalid crs code supplied'": |
