diff options
author | Birte Kristina Friesel <derf@finalrewind.org> | 2024-12-21 08:38:08 +0100 |
---|---|---|
committer | Birte Kristina Friesel <derf@finalrewind.org> | 2024-12-21 08:38:08 +0100 |
commit | fcc03913f0cbf619efd40d9b14e3e797867efd7a (patch) | |
tree | 274824c9eb4e8ba5f90c04d00d8515ae7fc6b3f4 | |
parent | 8f13385e31b81e544d991b629f783f90eaeab4a7 (diff) |
dbris-m: automatically run locationSearch when called with station name
-rwxr-xr-x | bin/dbris-m | 10 |
1 files changed, 10 insertions, 0 deletions
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); |