summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2025-11-16 21:38:58 +0100
committerBirte Kristina Friesel <derf@finalrewind.org>2025-11-16 21:38:58 +0100
commit65a08b86a13178675d40048e01abf9d6770ba11b (patch)
treeaa561f0220377471625bbba93217ff0101323917
parent13396e443590aa2611dc163a9593ebfb6afce503 (diff)
dbris-m: show trip number changes along the route, if any
-rwxr-xr-xbin/dbris-m18
1 files changed, 16 insertions, 2 deletions
diff --git a/bin/dbris-m b/bin/dbris-m
index 73028ee..65ca2d9 100755
--- a/bin/dbris-m
+++ b/bin/dbris-m
@@ -391,7 +391,7 @@ elsif ( $opt{journey} and not( $raw_json_output or $json_output ) ) {
printf( "%s %s am %s\n",
$trip->type,
- $trip->train_no // $trip->number,
+ $trip->line_no // join( q{ / }, $trip->trip_numbers ),
$trip->day->strftime('%d.%m.%Y') );
if ( $trip->operators ) {
@@ -399,6 +399,11 @@ elsif ( $opt{journey} and not( $raw_json_output or $json_output ) ) {
}
say q{};
+ my $prev_trip_no;
+ if ( scalar $trip->trip_numbers > 1 ) {
+ $prev_trip_no = $trip->train_no;
+ }
+
for my $stop ( $trip->route ) {
if ( $stop == $mark_stop ) {
print($output_bold);
@@ -426,11 +431,20 @@ elsif ( $opt{journey} and not( $raw_json_output or $json_output ) ) {
if ($max_occupancy) {
printf( " %${max_occupancy}s", format_occupancy($stop) );
}
- printf( " %-${max_name}s %${max_platform}s\n",
+ printf( " %-${max_name}s %${max_platform}s",
$stop->name, $stop->platform // q{} );
if ( $stop == $mark_stop ) {
print($output_reset);
}
+
+ if ( defined $prev_trip_no
+ and defined $stop->trip_no
+ and $stop->trip_no ne $prev_trip_no )
+ {
+ printf( ' (%s %s)', $trip->type, $stop->trip_no );
+ $prev_trip_no = $stop->trip_no;
+ }
+ print("\n");
}
if ( $trip->attributes ) {
say q{};