aboutsummaryrefslogtreecommitdiff
path: root/modules/nr.py
diff options
context:
space:
mode:
authorGravatar Evelyn2017-10-29 12:00:08 +0000
committerGravatar Evelyn2017-10-29 12:00:08 +0000
commit6008cbac2c187cb22b28592a35d5bebc8c94af41 (patch)
tree620a0f7311526560afdcfd5e0f0c4de0d5b99764 /modules/nr.py
parentHandle empty CAP, additional IRCLog feature, better tls, better channel_save ... (diff)
signature
NR: Add date filter
Diffstat (limited to 'modules/nr.py')
-rw-r--r--modules/nr.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/nr.py b/modules/nr.py
index 9af8cb5c..2556f554 100644
--- a/modules/nr.py
+++ b/modules/nr.py
@@ -1,5 +1,5 @@
import collections, re, time
-from datetime import datetime
+from datetime import datetime, date
from collections import Counter
import Utils
@@ -145,6 +145,7 @@ class Module(object):
"period": (120, lambda x: x.isdigit() and 1 <= int(x) <= 480, lambda x: int(x)),
"nonpassenger": (False, lambda x: type(x)==type(True)),
"time": ("", lambda x: len(x)==4 and x.isdigit()),
+ "date": ("", lambda x: len(x)==10),
"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)),
@@ -164,6 +165,9 @@ class Module(object):
if filter["time"]:
now = now.replace(hour=int(filter["time"][:2]))
now = now.replace(minute=int(filter["time"][2:]))
+ if filter["date"]:
+ newdate = datetime.strptime(filter["date"], "%Y-%m-%d").date()
+ now = now.replace(day=newdate.day, month=newdate.month, year=newdate.year)
method = client.service.GetArrivalDepartureBoardByCRS if len(location_code) == 3 else client.service.GetArrivalDepartureBoardByTIPLOC
try: