2 # -*- coding: utf-8 -*-
6 from gotovienna.realtime import *
9 parser = argparse.ArgumentParser(description='Get realtime public transport information for Vienna')
10 parser.add_argument('-l', metavar='name', type=str, help='line name')
11 parser.add_argument('-s', metavar='name', type=str, help='station name')
13 args = parser.parse_args()
22 s = args.s.decode('UTF-8')
27 stations = itip.get_stations(l)
28 for key in stations.keys():
31 for station in stations[key]:
33 if s.startswith(station[0]) or station[0].startswith(s):
35 print '* %s\n %s .....' % (key, station[0]), itip.get_departures(station[1])
37 print ' %s' % station[0]
40 line = {'U-Bahn': '|', 'Strassenbahn': '|', 'Bus': '|', 'Andere': '|', 'Nightline': '|'}
41 lines_sorted = lines.keys()
43 for li in lines_sorted:
46 elif li.endswith('A') or li.endswith('B') and li[1].isdigit():
48 elif li.startswith('U'):
50 elif li.startswith('N'):
55 line[type] += ' %s |' % li
56 for kv in line.items():