From fd805597f5fc6ee2a58a0d040192f46d414c5ac6 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Wed, 9 Nov 2022 18:17:05 +0100 Subject: HAFAS: filter out border stations --- lib/Travelynx/Helper/HAFAS.pm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/Travelynx/Helper/HAFAS.pm b/lib/Travelynx/Helper/HAFAS.pm index 78e1c8f..6d2f6d2 100644 --- a/lib/Travelynx/Helper/HAFAS.pm +++ b/lib/Travelynx/Helper/HAFAS.pm @@ -169,8 +169,13 @@ sub get_route_timestamps_p { [ $coord->{lon}, $coord->{lat} ] ); } } - my $iris_stations = join( '|', $opt{train}->route ); - my $hafas_stations = join( '|', @station_list ); + my $iris_stations = join( '|', $opt{train}->route ); + + # borders (Gr" as in "Grenze") are only returned by HAFAS. + # They are not stations. + my $hafas_stations + = join( '|', grep { $_ !~ m{(\(Gr\)|\)Gr)$} } @station_list ); + if ( $iris_stations eq $hafas_stations or index( $hafas_stations, $iris_stations ) != -1 ) { -- cgit v1.2.3