summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2025-11-30 18:33:47 +0100
committerBirte Kristina Friesel <derf@finalrewind.org>2025-11-30 18:33:47 +0100
commit46bacf679bd2b84466673108f691e79b0ac0a12b (patch)
tree4719b64b9256265f216db19b23f11b74475d05d9
parent986d3384b69a7df3070795a6433507bcdfa55846 (diff)
Allow users to specify the requested number of via stops
-rwxr-xr-xbin/dbris-m6
-rw-r--r--lib/Travel/Status/DE/DBRIS.pm3
2 files changed, 8 insertions, 1 deletions
diff --git a/bin/dbris-m b/bin/dbris-m
index c87bfb0..d4c189b 100755
--- a/bin/dbris-m
+++ b/bin/dbris-m
@@ -23,6 +23,7 @@ my $use_colour = 'auto';
my ( $json_output, $raw_json_output, $with_polyline );
my @output_args;
my %show_output;
+my $num_route_entries = 3;
my %known_mot = map { $_ => 1 }
(qw(ICE EC_IC IR REGIONAL SBAHN BUS SCHIFF UBAHN TRAM ANRUFPFLICHTIG));
@@ -54,6 +55,7 @@ GetOptions(
'devmode' => \$developer_mode,
'json' => \$json_output,
'raw-json' => \$raw_json_output,
+ 'route-entries=i' => \$num_route_entries,
'with-polyline' => \$with_polyline,
) or show_help(1);
@@ -97,9 +99,13 @@ for my $field ( split( qr{,}, join( q{,}, @output_args ) ) ) {
}
}
+# the "via"s reported by the backend typically include both the current stop
+# and the terminus. So we requist $num_route_entries + 2 stops to ensure that
+# we end up with at least $num_route_entries usable stops.
my %opt = (
cache => $cache,
station => $station,
+ num_vias => $num_route_entries + 2,
developer_mode => $developer_mode,
);
diff --git a/lib/Travel/Status/DE/DBRIS.pm b/lib/Travel/Status/DE/DBRIS.pm
index a81366e..4644eaf 100644
--- a/lib/Travel/Status/DE/DBRIS.pm
+++ b/lib/Travel/Status/DE/DBRIS.pm
@@ -68,7 +68,8 @@ sub new {
. $station->{eva}
. '&ortId='
. $station->{id}
- . '&mitVias=true&maxVias=8';
+ . '&mitVias=true&maxVias='
+ . ( $conf{num_vias} // 5 );
for my $mot (@mots) {
$req .= '&verkehrsmittel[]=' . $mot;
}