diff options
author | Birte Kristina Friesel <derf@finalrewind.org> | 2024-09-27 19:11:30 +0200 |
---|---|---|
committer | Birte Kristina Friesel <derf@finalrewind.org> | 2024-09-27 19:11:30 +0200 |
commit | 8977ed62d4d59d9f65235cb8214def781dc5674a (patch) | |
tree | d56fd62745b772a2f40c42515114d55947213c14 /bin | |
parent | 62eb6d374ac1ec08d093a8e035157c85952d7a2d (diff) |
Switch to transport-apis repo for enhanced backend definitions
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/efa-m | 20 |
1 files changed, 13 insertions, 7 deletions
@@ -12,6 +12,7 @@ use Encode qw(decode); use Getopt::Long qw(:config no_ignore_case bundling); use List::Util qw(first max none); use Travel::Status::DE::EFA; +use Travel::Status::DE::EFA::Services; my $service = 'VRR'; my $efa_url; @@ -112,7 +113,7 @@ if ($efa_url) { $service = undef; } elsif ($service) { - my $service_ref = Travel::Status::DE::EFA::get_service($service); + my $service_ref = Travel::Status::DE::EFA::Services::get_service($service); if ( not $service_ref ) { printf STDERR ( "Error: Unknown service '%s'. See 'efa-m --list' for a " @@ -156,8 +157,11 @@ sub show_help { sub show_services { printf( "%-45s %-14s %s\n\n", 'service', 'abbr. (-s)', 'url (-u)' ); - for my $service ( Travel::Status::DE::EFA::get_efa_urls() ) { - printf( "%-45s %-14s %s\n", @{$service}{qw(name shortname url)} ); + for my $shortname ( Travel::Status::DE::EFA::Services::get_service_ids() ) { + my $service + = Travel::Status::DE::EFA::Services::get_service($shortname); + printf( "%-45s %-14s %s\n", + $service->{name}, $shortname, $service->{url} ); } exit 0; @@ -437,16 +441,18 @@ sub show_results { } if ( $discover or $discover_and_print ) { - for my $service_ref ( Travel::Status::DE::EFA::get_efa_urls() ) { - $efa = new_efa( $service_ref->{shortname} ); + for my $shortname ( Travel::Status::DE::EFA::Services::get_service_ids() ) { + $efa = new_efa($shortname); if ( $efa and not $efa->errstr ) { if ($discover_and_print) { last; } + my $service_ref + = Travel::Status::DE::EFA::Services::get_service($shortname); printf( "%s / %s (%s)\n -> efa-m -s %s %s\n\n", - @{$service_ref}{qw(name shortname url shortname)}, - join( q{ }, map { "'$_'" } @ARGV ), + $service_ref->{name}, $shortname, $service_ref->{url}, + $shortname, join( q{ }, map { "'$_'" } @ARGV ), ); } } |