diff options
Diffstat (limited to 'bin/hafas-m')
-rwxr-xr-x | bin/hafas-m | 39 |
1 files changed, 28 insertions, 11 deletions
diff --git a/bin/hafas-m b/bin/hafas-m index f76cbb0..a6899b0 100755 --- a/bin/hafas-m +++ b/bin/hafas-m @@ -3,7 +3,7 @@ use strict; use warnings; use 5.014; -our $VERSION = '6.14'; +our $VERSION = '6.15'; use utf8; use DateTime; @@ -64,6 +64,11 @@ if ($list_services) { 'time zone' ); for my $service ( Travel::Status::DE::HAFAS::get_services() ) { + if ( $service->{shortname} eq 'DB' ) { + + # HTTP 503 Service Unavailable + next; + } printf( "%-40s %-14s %-15s %s\n", @{$service}{qw(name shortname)}, @@ -74,6 +79,18 @@ if ($list_services) { exit 0; } +if ( not $service ) { + say STDERR 'Note: You have called hafas-m without specifying a service.'; + say STDERR q{}; + say STDERR 'Unfortunately, the previous default service (DB HAFAS)'; + say STDERR 'is no more, and there is no generic replacement available.'; + say STDERR q{}; + say STDERR 'Please use "hafas-m --list" to list supported services,'; + say STDERR 'and then select one via -s <service>.'; + say STDERR 'Falling back to ÖBB for now.'; + $service = 'ÖBB'; +} + if ($use_cache) { my $cache_path = ( $ENV{XDG_CACHE_HOME} // "$ENV{HOME}/.cache" ) . '/Travel-Status-DE-HAFAS'; @@ -190,7 +207,7 @@ sub parse_mot_options { for my $type ( split( qr{,}, $types ) ) { if ( $type eq 'help' or $type eq 'list' or $type eq q{?} ) { - $service //= 'DB'; + $service //= 'ÖBB'; my $desc = Travel::Status::DE::HAFAS::get_service($service); if ($desc) { for my $mot ( @{ $desc->{productbits} } ) { @@ -384,7 +401,7 @@ if ( $opt{journeyMatch} ) { for my $result ( $status->results ) { my $start = ( $result->route )[0]; my $end = ( $result->route )[-1]; - say $result->id; + say $result->id =~ s{ }{}gr; print $result->name; if ( $result->number ) { printf( " | Nr %s", $result->number ); @@ -646,7 +663,7 @@ else { } if ($show_jid) { - $info_line = $d->id . ' ' . $info_line; + $info_line = $d->id =~ s{ }{}gr . ' ' . $info_line; } my $entry = [ @@ -656,7 +673,7 @@ else { ? q{} : format_delay( $d->delay, $delay_len ), $d->name, - $d->route_end, + $d->route_end // q{???}, ( $d->platform // q{} ) . ( $d->is_changed_platform ? ' !' : q{} ), $info_line, $d @@ -714,7 +731,7 @@ B<hafas-m> [B<-s> I<service>] [B<-l> I<language>] B<!>I<query>|I<journeyID> =head1 VERSION -version 6.14 +version 6.15 =head1 DESCRIPTION @@ -842,8 +859,8 @@ Useful for debugging and development purposes. =item B<-s>, B<--service> I<service> -Request arrivals/departures using the API provided by I<service>, defaults -to DB (Deutsche Bahn). See B<--list> for a list of known services. +Request arrivals/departures using the API provided by I<service>, defaults to +ÖBB (Österreichische Bundesbahnen). See B<--list> for a list of known services. =item B<-t>, B<--time> I<hh>:I<mm> (monitor) @@ -885,8 +902,8 @@ None. =over -=item * The non-default services (anything other than DB) are not well-tested. -Unlike DB, many of those do not return routes for stationboard entries. +=item * DB HAFAS is no more. At this point, there is no suitable HAFAS instance +that covers local and regional / long-distance transit in Germany. =item * HAFAS does not provide real-time data for routes of stationboard entries. Hence, B<--via> estimates the arrival time from scheduled @@ -896,7 +913,7 @@ departure and departure delay =head1 AUTHOR -Copyright (C) 2015-2023 by Birte Kristina Friesel E<lt>derf@finalrewind.orgE<gt> +Copyright (C) 2015-2025 Birte Kristina Friesel E<lt>derf@finalrewind.orgE<gt> =head1 LICENSE |