From fcc03913f0cbf619efd40d9b14e3e797867efd7a Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Sat, 21 Dec 2024 08:38:08 +0100 Subject: dbris-m: automatically run locationSearch when called with station name --- bin/dbris-m | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'bin') diff --git a/bin/dbris-m b/bin/dbris-m index 733b35b..26def34 100755 --- a/bin/dbris-m +++ b/bin/dbris-m @@ -75,6 +75,16 @@ elsif ( $opt{station} =~ m{[|]} ) { $opt{journey} = { id => $opt{station} }; delete $opt{station}; } +elsif ( $opt{station} !~ m{ ^ \d+ $ }x ) { + my $status + = Travel::Status::DE::DBRIS->new( locationSearch => $opt{station} ); + for my $result ( $status->results ) { + if ( defined $result->eva ) { + $opt{station} = $result->eva; + last; + } + } +} my $status = Travel::Status::DE::DBRIS->new(%opt); -- cgit v1.2.3