summaryrefslogtreecommitdiff
path: root/lib/DBInfoscreen
diff options
context:
space:
mode:
Diffstat (limited to 'lib/DBInfoscreen')
-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] } }