From a187abe014ee0d7dcd9228d72b20206414fb8ce5 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sat, 19 Nov 2022 21:58:25 +0100 Subject: Parse "hi" (arrival_hidden/departure_hidden) attributes --- lib/Travel/Status/DE/IRIS.pm | 8 ++++---- lib/Travel/Status/DE/IRIS/Result.pm | 22 ++++++++++++++++++++-- 2 files changed, 24 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/Travel/Status/DE/IRIS.pm b/lib/Travel/Status/DE/IRIS.pm index 3c07e8f..43b5313 100644 --- a/lib/Travel/Status/DE/IRIS.pm +++ b/lib/Travel/Status/DE/IRIS.pm @@ -585,9 +585,8 @@ sub add_result { $data{route_pre} = $e_ar->getAttribute('ppth'); $data{route_start} = $e_ar->getAttribute('pde'); $data{transfer} = $e_ar->getAttribute('tra'); + $data{arrival_hidden} = $e_ar->getAttribute('hi'); $data{arrival_wing_ids} = $e_ar->getAttribute('wings'); - - #$data{unk_ar_hi} = $e_ar->getAttribute('hi'); } if ($e_dp) { @@ -597,9 +596,8 @@ sub add_result { $data{route_post} = $e_dp->getAttribute('ppth'); $data{route_end} = $e_dp->getAttribute('pde'); $data{transfer} = $e_dp->getAttribute('tra'); + $data{departure_hidden} = $e_dp->getAttribute('hi'); $data{departure_wing_ids} = $e_dp->getAttribute('wings'); - - #$data{unk_dp_hi} = $e_dp->getAttribute('hi'); } if ( $data{arrival_wing_ids} ) { @@ -817,6 +815,7 @@ sub parse_realtime { sched_route_pre => $e_ar->getAttribute('ppth'), status => $e_ar->getAttribute('cs'), status_since => $e_ar->getAttribute('clt'), + arrival_hidden => $e_ar->getAttribute('hi'), # TODO ps='a' -> rerouted and normally unscheduled train? ); @@ -829,6 +828,7 @@ sub parse_realtime { route_post => $e_dp->getAttribute('cpth'), sched_route_post => $e_dp->getAttribute('ppth'), status => $e_dp->getAttribute('cs'), + departure_hidden => $e_dp->getAttribute('hi'), ); } diff --git a/lib/Travel/Status/DE/IRIS/Result.pm b/lib/Travel/Status/DE/IRIS/Result.pm index 9325de5..25abb0a 100644 --- a/lib/Travel/Status/DE/IRIS/Result.pm +++ b/lib/Travel/Status/DE/IRIS/Result.pm @@ -130,9 +130,9 @@ my %translation = ( ); Travel::Status::DE::IRIS::Result->mk_ro_accessors( - qw(arrival arrival_delay arrival_has_realtime arrival_is_additional arrival_is_cancelled + qw(arrival arrival_delay arrival_has_realtime arrival_is_additional arrival_is_cancelled arrival_hidden date datetime delay - departure departure_delay departure_has_realtime departure_is_additional departure_is_cancelled + departure departure_delay departure_has_realtime departure_is_additional departure_is_cancelled departure_hidden ds100 has_realtime is_transfer is_unscheduled is_wing line_no old_train_id old_train_no operator platform raw_id realtime_xml route_start route_end @@ -278,6 +278,10 @@ sub set_ar { $self->{arrival_is_cancelled} = 0; } + if ( $attrib{arrival_hidden} ) { + $self->{arrival_hidden} = $attrib{arrival_hidden}; + } + # unscheduled arrivals may not appear in the plan, but we do need to # know their planned arrival time if ( $attrib{plan_arrival_ts} ) { @@ -343,6 +347,10 @@ sub set_dp { $self->{departure_is_cancelled} = 0; } + if ( $attrib{departure_hidden} ) { + $self->{departure_hidden} = $attrib{departure_hidden}; + } + # unscheduled arrivals may not appear in the plan, but we do need to # know their planned arrival time if ( $attrib{plan_departure_ts} ) { @@ -911,6 +919,11 @@ no scheduled arrival time (e.g. due to diversions). May be negative. True if "arrival" is based on real-time data. +=item $result->arrival_hidden + +True if arrival should not be displayed to customers. +This often indicates an entry-only stop near the beginning of a train's journey. + =item $result->arrival_is_additional True if the arrival at this stop is an additional (unscheduled) event, i.e., @@ -984,6 +997,11 @@ no scheduled departure time (e.g. due to diversions). May be negative. True if "departure" is based on real-time data. +=item $result->departure_hidden + +True if departure should not be displayed to customers. +This often indicates an exit-only stop near the end of a train's journey. + =item $result->departure_is_additional True if the train's departure at this stop is unscheduled (additional), i.e., -- cgit v1.2.3