summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2023-11-07 21:03:34 +0100
committerBirte Kristina Friesel <derf@finalrewind.org>2023-11-07 21:03:34 +0100
commit6c191741e82aa908ef59f1059c72bf33d0577de1 (patch)
tree6821bb60c8c26b2edb1e21d895b972cca0052ee8
parentddec189cfeaa46d681043eaaaa8d99118f4069c9 (diff)
parse and expose arrival delay
-rw-r--r--lib/Travel/Routing/DE/EFA.pm5
-rw-r--r--lib/Travel/Routing/DE/EFA/Route/Part.pm19
2 files changed, 19 insertions, 5 deletions
diff --git a/lib/Travel/Routing/DE/EFA.pm b/lib/Travel/Routing/DE/EFA.pm
index 6094068..c294a8e 100644
--- a/lib/Travel/Routing/DE/EFA.pm
+++ b/lib/Travel/Routing/DE/EFA.pm
@@ -658,6 +658,8 @@ sub parse_xml_part {
$e_astime //= $e_atime;
my $delay = $e_delay ? $e_delay->getAttribute('delayMinutes') : 0;
+ my $delay_arr
+ = $e_delay ? $e_delay->getAttribute('delayMinutesArr') : 0;
my ( @dep_rms, @dep_sms, @arr_rms, @arr_sms );
@@ -673,8 +675,8 @@ sub parse_xml_part {
}
my $hash = {
- delay => $delay,
departure_date => $self->itddate_str($e_ddate),
+ departure_delay => $delay,
departure_time => $self->itdtime_str($e_dtime),
departure_sdate => $self->itddate_str($e_dsdate),
departure_stime => $self->itdtime_str($e_dstime),
@@ -685,6 +687,7 @@ sub parse_xml_part {
train_product => $e_mot->getAttribute('productName'),
train_destination => $e_mot->getAttribute('destination'),
arrival_date => $self->itddate_str($e_adate),
+ arrival_delay => $delay_arr,
arrival_time => $self->itdtime_str($e_atime),
arrival_sdate => $self->itddate_str($e_asdate),
arrival_stime => $self->itdtime_str($e_astime),
diff --git a/lib/Travel/Routing/DE/EFA/Route/Part.pm b/lib/Travel/Routing/DE/EFA/Route/Part.pm
index 3c9fe2c..fb94291 100644
--- a/lib/Travel/Routing/DE/EFA/Route/Part.pm
+++ b/lib/Travel/Routing/DE/EFA/Route/Part.pm
@@ -16,14 +16,15 @@ my %occupancy = (
Travel::Routing::DE::EFA::Route::Part->mk_ro_accessors(
qw(arrival_platform arrival_stop
- arrival_date arrival_time arrival_sdate arrival_stime delay
- departure_platform
+ arrival_date arrival_time arrival_sdate arrival_stime arrival_delay
+ delay
+ departure_platform departure_delay
departure_stop departure_date departure_time departure_sdate
departure_stime
footpath_duration footpath_type
occupancy
train_destination train_line train_product
- )
+ )
);
sub new {
@@ -38,6 +39,8 @@ sub new {
delete $ref->{occupancy};
}
+ $ref->{delay} = $ref->{departure_delay};
+
return bless( $ref, $obj );
}
@@ -188,6 +191,10 @@ included in the calculation, "Scheduled" means it isn't.
=over
+=item $part->arrival_delay
+
+arrival delay in minutes, 0 if unknown
+
=item $part->arrival_stop
arrival stop (city name plus station name)
@@ -237,7 +244,11 @@ Returns a list of Travel::Routing::DE::EFA::Route::Message(3pm) objects.
=item $part->delay
-delay in minutes, 0 if unknown
+alias for departure_delay
+
+=item $part->departure_delay
+
+departure delay in minutes, 0 if unknown
=item $part->departure_stop