Skip too close transports
This commit is contained in:
parent
0951369742
commit
a14edacb0e
@ -378,6 +378,8 @@ class RATPNextStopModule:
|
||||
|
||||
align = 0
|
||||
|
||||
mint = datetime.now() + timedelta(minutes=10)
|
||||
|
||||
api = IDFMAPI(config)
|
||||
for stop in stops:
|
||||
tmp = stop.split("/", 2)
|
||||
@ -387,6 +389,14 @@ class RATPNextStopModule:
|
||||
if 1 < len(tmp) < 4:
|
||||
prep = {}
|
||||
for s in api.get_schedules(mode, line, *tmp[1:]):
|
||||
# Skip too close items
|
||||
try:
|
||||
t = datetime.strptime(datetime.now().strftime("%Y-%m-%dT") + s["message"][0:5], "%Y-%m-%dT%H:%M")
|
||||
if t < mint:
|
||||
continue
|
||||
except:
|
||||
pass
|
||||
|
||||
if s["destination"] not in prep:
|
||||
prep[s["destination"]] = []
|
||||
prep[s["destination"]].append(s)
|
||||
|
Loading…
x
Reference in New Issue
Block a user