summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/dbris-m33
1 files changed, 26 insertions, 7 deletions
diff --git a/bin/dbris-m b/bin/dbris-m
index d4c189b..88804d5 100755
--- a/bin/dbris-m
+++ b/bin/dbris-m
@@ -414,10 +414,16 @@ elsif ( $opt{journey} and not( $raw_json_output or $json_output ) ) {
}
}
- printf( "%s %s am %s\n",
+ printf(
+ "%s %s am %s\n",
$trip->type,
- $trip->line_no // join( q{ / }, $trip->trip_numbers ),
- $trip->day->strftime('%d.%m.%Y') );
+ $trip->line_no // (
+ $trip->trip_numbers
+ ? join( q{ / }, $trip->trip_numbers )
+ : $trip->trip_no
+ ),
+ $trip->day->strftime('%d.%m.%Y')
+ );
if ( $trip->operators ) {
printf( "Betrieb: %s\n", join( q{, }, $trip->operators ) );
@@ -429,6 +435,11 @@ elsif ( $opt{journey} and not( $raw_json_output or $json_output ) ) {
$prev_operator = q{};
}
+ my $prev_type;
+ if ( scalar $trip->types > 1 ) {
+ $prev_type = q{};
+ }
+
my $prev_trip_no;
if ( scalar $trip->trip_numbers > 1 ) {
$prev_trip_no = q{};
@@ -475,11 +486,19 @@ elsif ( $opt{journey} and not( $raw_json_output or $json_output ) ) {
$prev_operator = $stop->operator;
}
- if ( defined $prev_trip_no
- and defined $stop->trip_no
- and $stop->trip_no ne $prev_trip_no )
+ if (
+ (
+ defined $prev_trip_no
+ and defined $stop->trip_no
+ and $stop->trip_no ne $prev_trip_no
+ )
+ or ( defined $prev_type
+ and defined $stop->trip_type
+ and $stop->trip_type ne $prev_type )
+ )
{
- printf( ' (%s %s)', $trip->type, $stop->trip_no );
+ printf( ' (%s %s)', $stop->trip_type, $stop->trip_no );
+ $prev_type = $stop->trip_type;
$prev_trip_no = $stop->trip_no;
}
print("\n");