Browse Source

Clear is called after data is retrieved now

no_compress
Raphael Roberts 7 years ago
parent
commit
9bc2f8633b
  1. 7
      main.py

7
main.py

@ -99,12 +99,14 @@ config = '''\
{nm}, stop {stop_id} {nm}, stop {stop_id}
{delta} ({t})\ {delta} ({t})\
''' '''
def show(stop_id,rt_filter=None):
def show(stop_id,rt_filter=None,_clear=False):
times = ctabus.get_times(stop_id)['prd'] times = ctabus.get_times(stop_id)['prd']
today = datetime.datetime.today() today = datetime.datetime.today()
arrivals = sorted(times,key = lambda t: t["prdtm"]) arrivals = sorted(times,key = lambda t: t["prdtm"])
if rt_filter is not None: if rt_filter is not None:
arrivals =filter(lambda arrival: arrival['rt'] == rt_filter,arrivals) arrivals =filter(lambda arrival: arrival['rt'] == rt_filter,arrivals)
if _clear:
clearscr()
for time in arrivals: for time in arrivals:
arrival = date_parse(time['prdtm']) arrival = date_parse(time['prdtm'])
if arrival > today: if arrival > today:
@ -158,8 +160,7 @@ if __name__ == "__main__":
_done = False _done = False
while not _done: while not _done:
try: try:
clearscr()
show(stop_id,args.route)
show(stop_id,args.route,True)
time.sleep(args.periodic) time.sleep(args.periodic)
except KeyboardInterrupt as e: except KeyboardInterrupt as e:
_done = True _done = True

Loading…
Cancel
Save