summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2024-03-24 16:51:08 +0100
committerBirte Kristina Friesel <derf@finalrewind.org>2024-03-24 16:51:08 +0100
commit7285e2ed1c9646f9a0042af79f3045892e797375 (patch)
tree3cdc95ee089d6c57f3ffa31aa7df3914968880db /lib
parent05661d3c9c695eb6ec57b1d8fe72e7274289bc27 (diff)
add via_stop support
Diffstat (limited to 'lib')
-rw-r--r--lib/Travel/Routing/DE/HAFAS.pm22
1 files changed, 19 insertions, 3 deletions
diff --git a/lib/Travel/Routing/DE/HAFAS.pm b/lib/Travel/Routing/DE/HAFAS.pm
index 0d9bb43..8418816 100644
--- a/lib/Travel/Routing/DE/HAFAS.pm
+++ b/lib/Travel/Routing/DE/HAFAS.pm
@@ -218,6 +218,7 @@ sub new {
messages => [],
results => [],
from_stop => $conf{from_stop},
+ via_stop => $conf{via_stop},
to_stop => $conf{to_stop},
ua => $ua,
now => $now,
@@ -231,7 +232,7 @@ sub new {
my $time = ( $conf{datetime} // $now )->strftime('%H%M%S');
my $outFrwd = $conf{arrival} ? \0 : undef;
- my ( $from_lid, $to_lid );
+ my ( $from_lid, $via_lid, $to_lid );
if ( $self->{from_stop} =~ m{ ^ [0-9]+ $ }x ) {
$from_lid = 'A=1@L=' . $self->{from_stop} . '@';
}
@@ -244,6 +245,14 @@ sub new {
else {
$to_lid = 'A=1@O=' . $self->{to_stop} . '@';
}
+ if ( $self->{via_stop} ) {
+ if ( $self->{via_stop} =~ m{ ^ [0-9]+ $ }x ) {
+ $via_lid = 'A=1@L=' . $self->{via_stop} . '@';
+ }
+ else {
+ $via_lid = 'A=1@O=' . $self->{via_stop} . '@';
+ }
+ }
$req = {
svcReqL => [
@@ -256,8 +265,10 @@ sub new {
maxChg => $conf{max_change},
minChgTime => undef,
outFrwd => $outFrwd,
- viaLocL => undef,
- trfReq => {
+ viaLocL => $via_lid
+ ? [ { loc => { lid => $via_lid } } ]
+ : undef,
+ trfReq => {
cType => 'PK',
tvlrProf => [ { type => 'E' } ],
},
@@ -709,6 +720,11 @@ must be specified either by name or by EVA ID (e.g. 8000080 for Dortmund Hbf).
Destination stop, e.g. "Essen HBf" or "Alfredusbad, Essen (Ruhr)". The stop
must be specified either by name or by EVA ID (e.g. 8000080 for Dortmund Hbf).
+=item B<via_stop> => I<stop>
+
+Only return connections that pass I<stop>. It must be specified either by name
+or by EVA ID (e.g. 8000080 for Dortmund Hbf).
+
=item B<arrival> => I<bool>
If true: request connections that arrive at the destination before the