diff options
author | Daniel Friesel <derf@finalrewind.org> | 2011-11-28 22:11:53 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2011-11-28 22:11:53 +0100 |
commit | 1d5e4aedb8d4e114b02d508fa52371d3218a1119 (patch) | |
tree | aadf70c0f451695af9c204b2c3c509de152e7450 /lib/Travel/Routing | |
parent | 10d600e8e573262ef812ff2197fe8426bad7da6a (diff) |
Initial support for intermediate stops (via -E -E). will be cleaned up tomorrow
Diffstat (limited to 'lib/Travel/Routing')
-rw-r--r-- | lib/Travel/Routing/DE/VRR.pm | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/Travel/Routing/DE/VRR.pm b/lib/Travel/Routing/DE/VRR.pm index e03bc91..713fb10 100644 --- a/lib/Travel/Routing/DE/VRR.pm +++ b/lib/Travel/Routing/DE/VRR.pm @@ -443,6 +443,7 @@ sub parse_part { = XML::LibXML::XPathExpression->new('./itdPoint[@usage="arrival"]'); my $xp_date = XML::LibXML::XPathExpression->new('./itdDateTime/itdDate'); 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'); @@ -497,6 +498,34 @@ sub parse_part { $hash->{$key} = decode( 'UTF-8', $hash->{$key} ); } + for my $ve ( $e->findnodes($xp_via) ) { + my $e_vdate = ( $ve->findnodes($xp_date) )[-1]; + my $e_vtime = ( $ve->findnodes($xp_time) )[-1]; + + if ( not( $e_vdate and $e_vtime ) + or ( $e_vdate->getAttribute('weekday') == -1 ) ) + { + next; + } + + my $name = decode( 'UTF-8', $ve->getAttribute('name') ); + my $platform = $ve->getAttribute('platformName'); + + if ( $name ~~ [ $hash->{departure_stop}, $hash->{arrival_stop} ] ) { + next; + } + + push( + @{ $hash->{via} }, + [ + $self->itddate_str($e_vdate), + $self->itdtime_str($e_vtime), + $name, + $platform + ] + ); + } + $hash->{extra} = [ map { decode( 'UTF-8', $_->textContent ) } @e_info ]; push( @route_parts, $hash ); |