summaryrefslogtreecommitdiff
path: root/lib/Travel/Routing/DE
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2011-11-29 14:41:18 +0100
committerDaniel Friesel <derf@finalrewind.org>2011-11-29 14:41:18 +0100
commit7e8258ae6c0cb53cdde02cf48f506eb9f7a29660 (patch)
tree5c72ea934d7b9f05799f8f63299fdf7953bcfecf /lib/Travel/Routing/DE
parent1d5e4aedb8d4e114b02d508fa52371d3218a1119 (diff)
Fix display and parsing of delay connections
Diffstat (limited to 'lib/Travel/Routing/DE')
-rw-r--r--lib/Travel/Routing/DE/VRR.pm41
-rw-r--r--lib/Travel/Routing/DE/VRR/Route/Part.pm13
2 files changed, 37 insertions, 17 deletions
diff --git a/lib/Travel/Routing/DE/VRR.pm b/lib/Travel/Routing/DE/VRR.pm
index 713fb10..56aa28e 100644
--- a/lib/Travel/Routing/DE/VRR.pm
+++ b/lib/Travel/Routing/DE/VRR.pm
@@ -445,9 +445,12 @@ sub parse_part {
my $xp_time = XML::LibXML::XPathExpression->new('./itdDateTime/itdTime');
my $xp_via = XML::LibXML::XPathExpression->new('./itdStopSeq/itdPoint');
-# my $xp_tdate = XML::LibXML::XPathExpression->new('./itdDateTimeTarget/itdDate');
-# my $xp_ttime = XML::LibXML::XPathExpression->new('./itdDateTimeTarget/itdTime');
- my $xp_mot = XML::LibXML::XPathExpression->new('./itdMeansOfTransport');
+ my $xp_sdate
+ = XML::LibXML::XPathExpression->new('./itdDateTimeTarget/itdDate');
+ my $xp_stime
+ = XML::LibXML::XPathExpression->new('./itdDateTimeTarget/itdTime');
+ my $xp_mot = XML::LibXML::XPathExpression->new('./itdMeansOfTransport');
+ my $xp_delay = XML::LibXML::XPathExpression->new('./itdRBLControlled');
my $xp_info
= XML::LibXML::XPathExpression->new('./itdInfoTextList/infoTextListElem');
@@ -472,24 +475,36 @@ sub parse_part {
for my $e ( $route->findnodes($xp_route) ) {
- my $e_dep = ( $e->findnodes($xp_dep) )[0];
- my $e_arr = ( $e->findnodes($xp_arr) )[0];
- my $e_ddate = ( $e_dep->findnodes($xp_date) )[0];
- my $e_dtime = ( $e_dep->findnodes($xp_time) )[0];
- my $e_adate = ( $e_arr->findnodes($xp_date) )[0];
- my $e_atime = ( $e_arr->findnodes($xp_time) )[0];
- my $e_mot = ( $e->findnodes($xp_mot) )[0];
- my @e_info = $e->findnodes($xp_info);
+ my $e_dep = ( $e->findnodes($xp_dep) )[0];
+ my $e_arr = ( $e->findnodes($xp_arr) )[0];
+ my $e_ddate = ( $e_dep->findnodes($xp_date) )[0];
+ my $e_dtime = ( $e_dep->findnodes($xp_time) )[0];
+ my $e_dsdate = ( $e_dep->findnodes($xp_sdate) )[0];
+ my $e_dstime = ( $e_dep->findnodes($xp_stime) )[0];
+ my $e_adate = ( $e_arr->findnodes($xp_date) )[0];
+ my $e_atime = ( $e_arr->findnodes($xp_time) )[0];
+ my $e_asdate = ( $e_arr->findnodes($xp_sdate) )[0];
+ my $e_astime = ( $e_arr->findnodes($xp_stime) )[0];
+ my $e_mot = ( $e->findnodes($xp_mot) )[0];
+ my $e_delay = ( $e->findnodes($xp_delay) )[0];
+ my @e_info = $e->findnodes($xp_info);
+
+ my $delay = $e_delay ? $e_delay->getAttribute('delayMinutes') : 0;
my $hash = {
- departure_time => $self->itdtime_str($e_dtime),
+ delay => $delay,
departure_date => $self->itddate_str($e_ddate),
+ departure_time => $self->itdtime_str($e_dtime),
+ departure_sdate => $self->itddate_str($e_dsdate),
+ departure_stime => $self->itdtime_str($e_dstime),
departure_stop => $e_dep->getAttribute('name'),
departure_platform => $e_dep->getAttribute('platformName'),
train_line => $e_mot->getAttribute('name'),
train_destination => $e_mot->getAttribute('destination'),
- arrival_time => $self->itdtime_str($e_atime),
arrival_date => $self->itddate_str($e_adate),
+ arrival_time => $self->itdtime_str($e_atime),
+ arrival_sdate => $self->itddate_str($e_asdate),
+ arrival_stime => $self->itdtime_str($e_astime),
arrival_stop => $e_arr->getAttribute('name'),
arrival_platform => $e_arr->getAttribute('platformName'),
};
diff --git a/lib/Travel/Routing/DE/VRR/Route/Part.pm b/lib/Travel/Routing/DE/VRR/Route/Part.pm
index d01260c..e31e713 100644
--- a/lib/Travel/Routing/DE/VRR/Route/Part.pm
+++ b/lib/Travel/Routing/DE/VRR/Route/Part.pm
@@ -9,8 +9,12 @@ use parent 'Class::Accessor';
our $VERSION = '1.06';
Travel::Routing::DE::VRR::Route::Part->mk_ro_accessors(
- qw(arrival_platform arrival_stop arrival_time departure_platform departure_stop departure_time train_line
- train_destination)
+ qw(arrival_platform arrival_stop
+ arrival_date arrival_time arrival_sdate arrival_stime
+ delay departure_platform departure_stop
+ departure_date departure_time departure_sdate departure_stime
+ train_line train_destination
+ )
);
sub new {
@@ -24,13 +28,14 @@ sub new {
sub arrival_stop_and_platform {
my ($self) = @_;
- return sprintf('%s: %s', $self->get(qw(arrival_stop arrival_platform)));
+ return sprintf( '%s: %s', $self->get(qw(arrival_stop arrival_platform)) );
}
sub departure_stop_and_platform {
my ($self) = @_;
- return sprintf('%s: %s', $self->get(qw(departure_stop departure_platform)));
+ return
+ sprintf( '%s: %s', $self->get(qw(departure_stop departure_platform)) );
}
sub extra {