summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/efa7
-rw-r--r--lib/Travel/Routing/DE/EFA.pm38
-rw-r--r--lib/Travel/Routing/DE/EFA/Route/Part.pm21
3 files changed, 59 insertions, 7 deletions
diff --git a/bin/efa b/bin/efa
index 38248c8..df945d6 100755
--- a/bin/efa
+++ b/bin/efa
@@ -145,13 +145,16 @@ sub display_connection {
$c->delay, $c->departure_stime, $c->arrival_stime );
}
- for my $extra ( $c->extra ) {
-
+ for my $extra ( $c->sched_info ) {
if ( not( length $ignore_info and $extra =~ /$ignore_info/i ) ) {
say "# $extra";
}
}
+ for my $notice ( $c->current_info ) {
+ printf( "# %s - %s\n", $notice->{subtitle}, $notice->{subject} );
+ }
+
if ( $opt->{maps} ) {
for my $m ( $c->departure_routemaps, $c->departure_stationmaps ) {
say "# $m";
diff --git a/lib/Travel/Routing/DE/EFA.pm b/lib/Travel/Routing/DE/EFA.pm
index ca5c051..f423cf8 100644
--- a/lib/Travel/Routing/DE/EFA.pm
+++ b/lib/Travel/Routing/DE/EFA.pm
@@ -497,6 +497,31 @@ sub itdtime_str {
$node->getAttribute('minute') );
}
+sub parse_cur_info {
+ my ( $self, $node ) = @_;
+
+ my $xp_text = XML::LibXML::XPathExpression->new('./infoLinkText');
+ my $xp_subject = XML::LibXML::XPathExpression->new('./infoText/subject');
+ my $xp_subtitle = XML::LibXML::XPathExpression->new('./infoText/subtitle');
+ my $xp_content = XML::LibXML::XPathExpression->new('./infoText/content');
+
+ my $e_text = ( $node->findnodes($xp_text) )[0];
+ my $e_subject = ( $node->findnodes($xp_subject) )[0];
+ my $e_subtitle = ( $node->findnodes($xp_subtitle) )[0];
+ my $e_content = ( $node->findnodes($xp_content) )[0];
+
+ my $ret = {
+ summary => $e_text->textContent,
+ subject => $e_subject->textContent,
+ subtitle => $e_subtitle->textContent,
+ content => $e_content->textContent,
+ };
+ for my $key ( keys %{$ret} ) {
+ $ret->{$key} = decode( 'UTF-8', $ret->{$key} );
+ }
+ return $ret;
+}
+
sub parse_xml_part {
my ( $self, $route ) = @_;
@@ -519,8 +544,10 @@ sub parse_xml_part {
my $xp_fp_e
= XML::LibXML::XPathExpression->new('./itdFootPathInfo/itdFootPathElem');
my $xp_delay = XML::LibXML::XPathExpression->new('./itdRBLControlled');
- my $xp_info
- = XML::LibXML::XPathExpression->new('./itdInfoTextList/infoTextListElem | ./infoLink/infoLinkText');
+
+ my $xp_sched_info
+ = XML::LibXML::XPathExpression->new('./itdInfoTextList/infoTextListElem');
+ my $xp_cur_info = XML::LibXML::XPathExpression->new('./infoLink');
my $xp_mapitem_rm = XML::LibXML::XPathExpression->new(
'./itdMapItemList/itdMapItem[@type="RM"]/itdImage');
@@ -561,7 +588,8 @@ sub parse_xml_part {
my $e_mot = ( $e->findnodes($xp_mot) )[0];
my $e_delay = ( $e->findnodes($xp_delay) )[0];
my $e_fp = ( $e->findnodes($xp_fp) )[0];
- my @e_info = $e->findnodes($xp_info);
+ my @e_sinfo = $e->findnodes($xp_sched_info);
+ my @e_cinfo = $e->findnodes($xp_cur_info);
my @e_dmap_rm = $e_dep->findnodes($xp_mapitem_rm);
my @e_dmap_sm = $e_dep->findnodes($xp_mapitem_sm);
my @e_amap_rm = $e_arr->findnodes($xp_mapitem_rm);
@@ -662,7 +690,9 @@ sub parse_xml_part {
);
}
- $hash->{extra} = [ map { decode( 'UTF-8', $_->textContent ) } @e_info ];
+ $hash->{sched_info}
+ = [ map { decode( 'UTF-8', $_->textContent ) } @e_sinfo ];
+ $hash->{current_info} = [ map { $self->parse_cur_info($_) } @e_cinfo ];
push( @route_parts, $hash );
}
diff --git a/lib/Travel/Routing/DE/EFA/Route/Part.pm b/lib/Travel/Routing/DE/EFA/Route/Part.pm
index cc52f80..3bf5d60 100644
--- a/lib/Travel/Routing/DE/EFA/Route/Part.pm
+++ b/lib/Travel/Routing/DE/EFA/Route/Part.pm
@@ -82,10 +82,29 @@ sub footpath_parts {
return;
}
+# DEPRECATED
sub extra {
my ($self) = @_;
- return @{ $self->{extra} // [] };
+ return @{ $self->{sched_info} // [] };
+}
+
+sub sched_info {
+ my ($self) = @_;
+
+ if ( $self->{sched_info} ) {
+ return @{ $self->{sched_info} };
+ }
+ return;
+}
+
+sub current_info {
+ my ($self) = @_;
+
+ if ( $self->{current_info} ) {
+ return @{ $self->{current_info} };
+ }
+ return;
}
sub via {