summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/efa15
-rw-r--r--lib/Travel/Routing/DE/VRR.pm29
2 files changed, 41 insertions, 3 deletions
diff --git a/bin/efa b/bin/efa
index a4972e4..1844102 100755
--- a/bin/efa
+++ b/bin/efa
@@ -114,7 +114,7 @@ GetOptions(
date|d=s
depart=s
exclude|e=s@
- extended-info|E
+ extended-info|E+
from=s@{2}
help|h
ignore-info|I:s
@@ -215,10 +215,19 @@ for my $i ( 0 .. $#routes ) {
}
printf(
- "%-5s ab %-30s %-20s %s\n%-5s an %s\n\n",
+ "%-5s ab %-30s %-20s %s\n",
$c->departure_time, $c->departure_stop_and_platform,
$c->train_line, $c->train_destination,
- $c->arrival_time, $c->arrival_stop_and_platform,
+ );
+
+ if ( $opt->{'extended-info'} and $opt->{'extended-info'} == 2 ) {
+ for my $via ( @{ $c->{via} } ) {
+ printf( "%-5s %-22s %s\n", @{$via}[ 1 .. 3 ] );
+ }
+ }
+
+ printf( "%-5s an %s\n\n",
+ $c->arrival_time, $c->arrival_stop_and_platform,
);
}
if ( $i != $#routes ) {
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 );