summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2020-09-27 20:41:05 +0200
committerDaniel Friesel <derf@finalrewind.org>2020-09-27 20:41:05 +0200
commit5f8418a255d9384305e2fa7e08a11aa442e69921 (patch)
treef063adfe2d370d6d2f1ed470557ef1ef8b5d55a3 /lib
parent9ae7fa5bb5ee4bb76c0a1bae89d9288aa949b5b3 (diff)
show train class based on IRIS data3.3.6
Diffstat (limited to 'lib')
-rw-r--r--lib/DBInfoscreen/Controller/Stationboard.pm40
1 files changed, 20 insertions, 20 deletions
diff --git a/lib/DBInfoscreen/Controller/Stationboard.pm b/lib/DBInfoscreen/Controller/Stationboard.pm
index cba737c..aebd4b6 100644
--- a/lib/DBInfoscreen/Controller/Stationboard.pm
+++ b/lib/DBInfoscreen/Controller/Stationboard.pm
@@ -426,29 +426,16 @@ sub render_train {
];
my $linetype = 'bahn';
- if ( $departure->{train_type} eq 'S' ) {
- $linetype = 'sbahn';
- }
- elsif ($departure->{train_type} eq 'IC'
- or $departure->{train_type} eq 'ICE'
- or $departure->{train_type} eq 'EC'
- or $departure->{train_type} eq 'ECE'
- or $departure->{train_type} eq 'EN' )
- {
- $linetype = 'fern';
- }
- elsif ($departure->{train_type} eq 'THA'
- or $departure->{train_type} eq 'TGV'
- or $departure->{train_type} eq 'FLX'
- or $departure->{train_type} eq 'NJ' )
- {
+ my @classes = $result->classes;
+ if ( @classes == 0 ) {
$linetype = 'ext';
}
- elsif ( $departure->{train_line}
- and $departure->{train_line} =~ m{^S\d} )
- {
+ elsif ( grep { $_ eq 'S' } @classes ) {
$linetype = 'sbahn';
}
+ elsif ( grep { $_ eq 'F' } @classes ) {
+ $linetype = 'fern';
+ }
$self->render_later;
@@ -841,10 +828,22 @@ sub handle_result {
( $info, $moreinfo ) = $self->format_hafas_result_info($result);
}
- my $time = $result->time;
+ my $time = $result->time;
+ my $linetype = 'bahn';
if ( $backend eq 'iris' ) {
+ my @classes = $result->classes;
+ if ( @classes == 0 ) {
+ $linetype = 'ext';
+ }
+ elsif ( grep { $_ eq 'S' } @classes ) {
+ $linetype = 'sbahn';
+ }
+ elsif ( grep { $_ eq 'F' } @classes ) {
+ $linetype = 'fern';
+ }
+
# ->time defaults to dep, so we only need to overwrite $time
# if we want arrival times
if ( $admode eq 'arr' ) {
@@ -1068,6 +1067,7 @@ sub handle_result {
is_cancelled => $result->is_cancelled,
departure_is_cancelled => $result->departure_is_cancelled,
arrival_is_cancelled => $result->arrival_is_cancelled,
+ linetype => $linetype,
messages => {
delay => [
map { { timestamp => $_->[0], text => $_->[1] } }