From eae082a2110ec16d630b1a1d0f76fae3366e9632 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 17 Aug 2014 15:56:28 +0200 Subject: Add shortname to EFA service list --- bin/efa | 11 ++++-- lib/Travel/Routing/DE/EFA.pm | 93 +++++++++++++++++++++++++++----------------- 2 files changed, 64 insertions(+), 40 deletions(-) diff --git a/bin/efa b/bin/efa index 33730d9..ee85bf7 100755 --- a/bin/efa +++ b/bin/efa @@ -223,11 +223,10 @@ if ( $opt->{exclude} ) { } if ( $opt->{discover} or $opt->{'auto-url'} ) { - for my $pair ( Travel::Routing::DE::EFA::get_efa_urls() ) { - my ( $url, $name ) = @{$pair}; + for my $service ( Travel::Routing::DE::EFA::get_efa_urls() ) { $efa = eval { Travel::Routing::DE::EFA->new( - efa_url => $url, + efa_url => $service->{url}, origin => [ @from, $from_type ], destination => [ @to, $to_type ], @@ -253,7 +252,11 @@ if ( $opt->{discover} or $opt->{'auto-url'} ) { if ( $opt->{'auto-url'} ) { last; } - printf( "%-55s (%s)\n", $url, $name ); + printf( + "%s / %s (%s)\n -> efa -s %s %s\n\n", + @{$service}{qw(name shortname url shortname)}, + join( ' ', map { "'$_'" } @ARGV ), + ); } } if ( $opt->{'discover'} ) { diff --git a/lib/Travel/Routing/DE/EFA.pm b/lib/Travel/Routing/DE/EFA.pm index 245afbf..876e865 100644 --- a/lib/Travel/Routing/DE/EFA.pm +++ b/lib/Travel/Routing/DE/EFA.pm @@ -745,39 +745,51 @@ sub routes { # static sub get_efa_urls { return ( - [ - 'http://efa.ivb.at/ivb/XSLT_TRIP_REQUEST2', - 'Innsbrucker Verkehsbetriebe' - ], - [ - 'http://efa.svv-info.at/sbs/XSLT_TRIP_REQUEST2', - 'Salzburger Verkehrsverbund' - ], - [ - 'http://efa.vor.at/wvb/XSLT_TRIP_REQUEST2', - 'Verkehrsverbund Ost-Region' - ], - [ - 'http://efaneu.vmobil.at/vvv/XSLT_TRIP_REQUEST2', - 'Vorarlberger Verkehrsverbund' - ], - [ - 'http://fahrplan.verbundlinie.at/stv/XSLT_TRIP_REQUEST2', - 'Verkehsverbund Steiermark' - ], - [ 'http://www.linzag.at/static/XSLT_TRIP_REQUEST2', 'Linz AG' ], - [ - 'http://212.114.197.7/vgnExt_oeffi/XML_TRIP_REQUEST2', - 'Verkehrsverbund Grossraum Nuernberg' - ], - [ - 'http://efa.vrr.de/vrr/XSLT_TRIP_REQUEST2', - 'Verkehrsverbund Rhein-Ruhr' - ], - [ - 'http://www2.vvs.de/vvs/XSLT_TRIP_REQUEST2', - 'Verkehrsverbund Stuttgart' - ], + { + url => 'http://efa.ivb.at/ivb/XSLT_TRIP_REQUEST2', + name => 'Innsbrucker Verkehsbetriebe', + shortname => 'IVB', + }, + { + url => 'http://efa.svv-info.at/sbs/XSLT_TRIP_REQUEST2', + name => 'Salzburger Verkehrsverbund', + shortname => 'SVV', + }, + { + url => 'http://efa.vor.at/wvb/XSLT_TRIP_REQUEST2', + name => 'Verkehrsverbund Ost-Region', + shortname => 'VOR', + }, + { + url => 'http://efaneu.vmobil.at/vvv/XSLT_TRIP_REQUEST2', + name => 'Vorarlberger Verkehrsverbund', + shortname => 'VVV', + }, + { + url => 'http://fahrplan.verbundlinie.at/stv/XSLT_TRIP_REQUEST2', + name => 'Verkehsverbund Steiermark', + shortname => 'Verbundlinie', + }, + { + url => 'http://www.linzag.at/static/XSLT_TRIP_REQUEST2', + name => 'Linz AG', + shortname => 'LinzAG', + }, + { + url => 'http://212.114.197.7/vgnExt_oeffi/XML_TRIP_REQUEST2', + name => 'Verkehrsverbund Grossraum Nuernberg', + shortname => 'VGN', + }, + { + url => 'http://efa.vrr.de/vrr/XSLT_TRIP_REQUEST2', + name => 'Verkehrsverbund Rhein-Ruhr', + shortname => 'VRR', + }, + { + url => 'http://www2.vvs.de/vvs/XSLT_TRIP_REQUEST2', + name => 'Verkehrsverbund Stuttgart', + shortname => 'VVS', + }, ); } @@ -1002,9 +1014,18 @@ The following methods act like the arguments to B. See there. =item Travel::Routing::DE::EFA::get_efa_urls() -Returns a list of known EFA entry points. Each list element is a reference to -an array consisting of two strings. The first one is the URL (as passed to -B), the second describes the entity to which this URL belongs. +Returns a list of known EFA entry points. Each list element is a hashref with +the following elements. + +=over + +=item B: service URL as passed to B + +=item B: Name of the entity operating this service + +=item B: Short name of the entity + +=back =back -- cgit v1.2.3