summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2014-08-17 15:56:28 +0200
committerDaniel Friesel <derf@finalrewind.org>2014-08-17 15:56:28 +0200
commiteae082a2110ec16d630b1a1d0f76fae3366e9632 (patch)
treefe7aef0a5e5abf601471162f51f0add10a18c5ec
parent430eda59e8739d195c79a7b42d5c1fd3a545d46c (diff)
Add shortname to EFA service list
-rwxr-xr-xbin/efa11
-rw-r--r--lib/Travel/Routing/DE/EFA.pm93
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<new>. 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<efa_url>), 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<url>: service URL as passed to B<efa_url>
+
+=item B<name>: Name of the entity operating this service
+
+=item B<shortname>: Short name of the entity
+
+=back
=back