2 # -*- coding: utf-8 -*-
4 from BeautifulSoup import BeautifulSoup
5 from urllib2 import urlopen
7 from datetime import time
11 from gotovienna.realtime import ITipParser
14 parser = argparse.ArgumentParser(description='Get realtime public transport information for Vienna')
15 parser.add_argument('-l', metavar='name', type=str, help='line name')
16 parser.add_argument('-s', metavar='name', type=str, help='station name')
18 args = parser.parse_args()
27 s = args.s.decode('UTF-8')
32 stations = itip.get_stations(l)
33 for key in stations.keys():
36 for station in stations[key]:
38 if s.startswith(station[0]) or station[0].startswith(s):
40 print '* %s\n %s .....' % (key, station[0]), itip.get_departures(station[1])
42 print ' %s' % station[0]
45 line = {'U-Bahn': '|', 'Strassenbahn': '|', 'Bus': '|', 'Andere': '|', 'Nightline': '|'}
46 lines_sorted = lines.keys()
48 for li in lines_sorted:
51 elif li.endswith('A') or li.endswith('B') and li[1].isdigit():
53 elif li.startswith('U'):
55 elif li.startswith('N'):
60 line[type] += ' %s |' % li
61 for kv in line.items():