From 6f9e52c6d15deaa9e0002b72516fb53733cbacad Mon Sep 17 00:00:00 2001 From: Florian Schweikert Date: Sun, 16 Oct 2011 19:19:09 +0200 Subject: [PATCH] just small format changes --- gotovienna/routing.py | 14 +- images/background.svg | 452 +++++++++++++++++++++++++++++++++++++++---------- scotty | 21 ++- 3 files changed, 391 insertions(+), 96 deletions(-) diff --git a/gotovienna/routing.py b/gotovienna/routing.py index 11149db..e70b757 100644 --- a/gotovienna/routing.py +++ b/gotovienna/routing.py @@ -163,18 +163,22 @@ class sParser: places_destination = self.soup.find('select', {'id': 'placeList_destination'}) - if names_origin or names_destination or places_origin or places_destination: + if any([names_origin, names_destination, places_origin, places_destination]): dict = {} if names_origin: - dict['origin'] = map(lambda x: x.text, names_origin.findAll('option')) + dict['origin'] = map(lambda x: x.text, + names_origin.findAll('option')) if names_destination: - dict['destination'] = map(lambda x: x.text, names_destination.findAll('option')) + dict['destination'] = map(lambda x: x.text, + names_destination.findAll('option')) if places_origin: - dict['place_origin'] = map(lambda x: x.text, names_origin.findAll('option')) + dict['place_origin'] = map(lambda x: x.text, + names_origin.findAll('option')) if names_destination: - dict['place_destination'] = map(lambda x: x.text, names_destination.findAll('option')) + dict['place_destination'] = map(lambda x: x.text, + names_destination.findAll('option')) return dict diff --git a/images/background.svg b/images/background.svg index e90f4e5..498d80a 100644 --- a/images/background.svg +++ b/images/background.svg @@ -1,85 +1,367 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/scotty b/scotty index d198087..ca7922c 100755 --- a/scotty +++ b/scotty @@ -8,10 +8,16 @@ from gotovienna.utils import * from gotovienna.routing import * parser = argparse.ArgumentParser(description='Get public transport route for Vienna') -parser.add_argument('-ot', metavar='type', type=str, help='origin type: %s' % ' | '.join(POSITION_TYPES), default=None, choices=POSITION_TYPES) -parser.add_argument('-dt', metavar='type', type=str, help='destination type: %s' % ' | '.join(POSITION_TYPES), default=None, choices=POSITION_TYPES) -parser.add_argument('origin', nargs='?', help='origin station name') -parser.add_argument('destination', nargs='?', help='destination station name') +parser.add_argument('-ot', metavar='type', type=str, + help='origin type: %s' % ' | '.join(POSITION_TYPES), + default=None, choices=POSITION_TYPES) +parser.add_argument('-dt', metavar='type', type=str, + help='destination type: %s' % ' | '.join(POSITION_TYPES), + default=None, choices=POSITION_TYPES) +parser.add_argument('origin', nargs='?', + help='origin station name') +parser.add_argument('destination', nargs='?', + help='destination station name') args = parser.parse_args() @@ -90,8 +96,11 @@ if parser.state == PageType.RESULT: if l.isdigit() and int(l) <= len(details): for detail in details[int(l) - 1]: if detail['timespan'] and detail['station']: - time = '%s - %s' % (detail['timespan'][0].strftime(TIMEFORMAT), detail['timespan'][1].strftime(TIMEFORMAT)) - print '[%s] %s\n%s' % (time, ' -> '.join(detail['station']), '\n'.join(detail['info'])) + time = '%s - %s' % (detail['timespan'][0].strftime(TIMEFORMAT), + detail['timespan'][1].strftime(TIMEFORMAT)) + print '[%s] %s\n%s' % (time, + ' -> '.join(detail['station']), + '\n'.join(detail['info'])) else: print '\n'.join(detail['info']) print '-' * 79 -- 1.7.9.5