summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2019-06-23 17:08:47 +0200
committerDaniel Friesel <derf@finalrewind.org>2019-06-23 17:08:47 +0200
commit16c441e4333c205235a3e13fd914b087a1ad6a66 (patch)
treeaa5bfd4d356cfc203f8c1cdc2a4e759eb2004eee
parentb3b08238292d0e794a268defd82f76d522f71949 (diff)
also show exit direction based on wagon order
-rwxr-xr-xlib/Travelynx.pm33
1 files changed, 33 insertions, 0 deletions
diff --git a/lib/Travelynx.pm b/lib/Travelynx.pm
index 0755e77..d6a4899 100755
--- a/lib/Travelynx.pm
+++ b/lib/Travelynx.pm
@@ -13,6 +13,7 @@ use Geo::Distance;
use JSON;
use List::Util qw(first);
use List::MoreUtils qw(after_incl before_incl);
+use Travel::Status::DE::DBWagenreihung;
use Travel::Status::DE::IRIS;
use Travel::Status::DE::IRIS::Stations;
use Travelynx::Helper::Sendmail;
@@ -2375,6 +2376,38 @@ sub startup {
if ( $platform_info->{kopfgleis} ) {
$ret->{arr_direction} = $platform_info->{direction};
}
+ elsif ( $in_transit->{data}{wagonorder_arr} ) {
+ my $wr;
+ eval {
+ $wr
+ = Travel::Status::DE::DBWagenreihung->new(
+ from_json =>
+ $in_transit->{data}{wagonorder_arr} );
+ };
+ if ( $wr
+ and $wr->sections
+ and defined $wr->direction )
+ {
+ my $section_0 = ( $wr->sections )[0];
+ my $direction = $wr->direction;
+ if ( $section_0 eq 'A' and $direction == 0 ) {
+ $ret->{arr_direction}
+ = $platform_info->{direction};
+ }
+ elsif ( $section_0 ne 'A'
+ and $direction == 100 )
+ {
+ $ret->{arr_direction}
+ = $platform_info->{direction};
+ }
+ else {
+ $ret->{arr_direction}
+ = $platform_info->{direction} eq 'r'
+ ? 'l'
+ : 'r';
+ }
+ }
+ }
}
}