- if state == PageType.CORRECTION:
- try:
- cor = parser.get_correction()
- origin, origin_place = split_station(args.origin)
- destination, destination_place = split_station(args.destination)
-
- # FIXME refactoring
-
- if cor.has_key('origin'):
- print
- print '* Origin ambiguous:'
- l = None
- while not l or not l.isdigit() or int(l) > len(cor['origin']):
- i = 1
- for c in cor['origin']:
- print '%d. %s' % (i, c)
- i += 1
- l = sys.stdin.readline().strip()
-
- origin = cor['origin'][int(l) - 1]
-
- if cor.has_key('destination'):
- print
- print '* Destination ambiguous:'
- l = None
- while not l or not l.isdigit() or int(l) > len(cor['destination']):
- i = 1
- for c in cor['destination']:
- print '%d. %s' % (i, c)
- i += 1
- l = sys.stdin.readline().strip()
-
- destination = cor['destination'][int(l) - 1]
-
- if cor.has_key('origin_place'):
- print
- print '* Origin place ambiguous:'
- l = None
- while not l or not l.isdigit() or int(l) > len(cor['origin_place']):
- i = 1
- for c in cor['origin_place']:
- print '%d. %s' % (i, c)
- i += 1
- l = sys.stdin.readline().strip()
-
- origin_place = cor['origin_place'][int(l) - 1]
-
- if cor.has_key('destination_place'):
- print
- print '* Destination place ambiguous:'
- l = None
- while not l or not l.isdigit() or int(l) > len(cor['destination_place']):
- i = 1
- for c in cor['destination_place']:
- print '%d. %s' % (i, c)
- i += 1
- l = sys.stdin.readline().strip()
-
- destination_place = cor['destination_place'][int(l) - 1]
-
- args.origin = '%s, %s' % (origin, origin_place)
- args.destination = '%s, %s' %(destination, destination_place)
+ args.origin = origin_corr[int(lo) - 1]
+
+ if destination_corr:
+ print
+ print '* Destination ambiguous:'
+ ld = None
+ while not ld or not ld.isdigit() or int(ld) > len(destination_corr):
+ for idx, correction in enumerate(destination_corr):
+ print '%3d. %s' % (idx+1, correction)
+ ld = sys.stdin.readline().strip()
+
+ args.destination = destination_corr[int(ld) - 1]
+
+ parser = do_search(args)
+
+if parser.state == PageType.RESULT:
+ parser = parser.get_result()
+ overviews = parser.overview
+ details = parser.details
+ l = ''
+ while not l == 'q':
+ for idx, overview in enumerate(overviews):
+ timespan = overview['timespan']
+ if not timespan:
+ # XXX: Bogus data for e.g. Pilgramgasse->Karlsplatz?!
+ continue