summaryrefslogtreecommitdiff
path: root/lib/Travel/Status/DE
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Travel/Status/DE')
-rw-r--r--lib/Travel/Status/DE/HAFAS.pm33
-rw-r--r--lib/Travel/Status/DE/HAFAS/Result.pm2
2 files changed, 34 insertions, 1 deletions
diff --git a/lib/Travel/Status/DE/HAFAS.pm b/lib/Travel/Status/DE/HAFAS.pm
index 2a2b3f4..a1660c8 100644
--- a/lib/Travel/Status/DE/HAFAS.pm
+++ b/lib/Travel/Status/DE/HAFAS.pm
@@ -495,6 +495,38 @@ sub parse_mgate {
}
}
+ my @stops;
+ for my $stop ( @{ $result->{stopL} // [] } ) {
+ my $loc = $locL[ $stop->{locX} ];
+ my $arr = $stop->{aTimeS};
+ my $arr_dt;
+ if ($arr) {
+ if ( length($arr) == 8 ) {
+
+ # arrival time includes a day offset
+ my $offset_date = $self->{now}->clone;
+ $offset_date->add( days => substr( $arr, 0, 2, q{} ) );
+ $offset_date = $offset_date->strftime('%Y%m%d');
+ $arr_dt = $self->{strptime_obj}
+ ->parse_datetime("${offset_date}T${arr}");
+ }
+ else {
+ $arr_dt
+ = $self->{strptime_obj}->parse_datetime("${date}T${arr}");
+ }
+ }
+ push(
+ @stops,
+ {
+ name => $loc->{name},
+ eva => $loc->{extId} + 0,
+ arrival => $arr_dt,
+ }
+ );
+ }
+
+ shift @stops;
+
push(
@{ $self->{results} },
Travel::Status::DE::HAFAS::Result->new(
@@ -510,6 +542,7 @@ sub parse_mgate {
platform => $platform,
new_platform => $new_platform,
messages => \@messages,
+ route => \@stops,
)
);
}
diff --git a/lib/Travel/Status/DE/HAFAS/Result.pm b/lib/Travel/Status/DE/HAFAS/Result.pm
index 1fc13ce..b217473 100644
--- a/lib/Travel/Status/DE/HAFAS/Result.pm
+++ b/lib/Travel/Status/DE/HAFAS/Result.pm
@@ -12,7 +12,7 @@ our $VERSION = '3.01';
Travel::Status::DE::HAFAS::Result->mk_ro_accessors(
qw(sched_date date sched_datetime datetime info is_cancelled operator delay
- sched_time time train route_end)
+ sched_time time train route route_end)
);
sub new {