summaryrefslogtreecommitdiff
path: root/lib/Travel/Status/DE/DeutscheBahn.pm
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2015-05-09 10:00:40 +0200
committerDaniel Friesel <derf@finalrewind.org>2015-05-09 10:00:40 +0200
commitfd5b343a0b56e0e887ab514b38496212beac7b8d (patch)
tree530a36440fdc57de2d1dd250b49fc75301891859 /lib/Travel/Status/DE/DeutscheBahn.pm
parent036fb77c6f84907aa0ff973cfe11d13c1c42c2de (diff)
parse route_info field
Diffstat (limited to 'lib/Travel/Status/DE/DeutscheBahn.pm')
-rw-r--r--lib/Travel/Status/DE/DeutscheBahn.pm39
1 files changed, 21 insertions, 18 deletions
diff --git a/lib/Travel/Status/DE/DeutscheBahn.pm b/lib/Travel/Status/DE/DeutscheBahn.pm
index b3170e0..4b9534a 100644
--- a/lib/Travel/Status/DE/DeutscheBahn.pm
+++ b/lib/Travel/Status/DE/DeutscheBahn.pm
@@ -171,12 +171,13 @@ sub results {
my $re_morelink = qr{ date = (?<date> .. [.] .. [.] .. ) }x;
my @parts = (
- [ 'time', './td[@class="time"]' ],
- [ 'train', './td[3]' ],
- [ 'route', './td[@class="route"]' ],
- [ 'dest', './td[@class="route"]//a' ],
- [ 'platform', './td[@class="platform"]' ],
- [ 'info', './td[@class="ris"]' ],
+ [ 'time', './td[@class="time"]' ],
+ [ 'train', './td[3]' ],
+ [ 'route', './td[@class="route"]' ],
+ [ 'dest', './td[@class="route"]//a' ],
+ [ 'platform', './td[@class="platform"]' ],
+ [ 'info', './td[@class="ris"]' ],
+ [ 'routeinfo', './td[@class="route"]//span[@class="red bold"]' ],
);
@parts = map { [ $_->[0], XML::LibXML::XPathExpression->new( $_->[1] ) ] }
@@ -200,7 +201,7 @@ sub results {
my @via;
my $first = 1;
- my ( $time, $train, $route, $dest, $platform, $info )
+ my ( $time, $train, $route, $dest, $platform, $info, $routeinfo )
= map { get_node( $tr, @{$_} ) } @parts;
my $e_train_more = ( $tr->findnodes($xp_train_more) )[0];
@@ -214,10 +215,11 @@ sub results {
substr( $date, 6, 0 ) = '20';
- $platform //= q{};
- $info //= q{};
+ $platform //= q{};
+ $info //= q{};
+ $routeinfo //= q{};
- for my $str ( $time, $train, $dest, $platform, $info ) {
+ for my $str ( $time, $train, $dest, $platform, $info, $routeinfo ) {
$str =~ s/\n/ /mg;
$str =~ tr/ //s;
$str =~ s/^ +//;
@@ -240,14 +242,15 @@ sub results {
push(
@{ $self->{results} },
Travel::Status::DE::DeutscheBahn::Result->new(
- date => $date,
- time => $time,
- train => $train,
- route_raw => $route,
- route => \@via,
- route_end => $dest,
- platform => $platform,
- info_raw => $info,
+ date => $date,
+ time => $time,
+ train => $train,
+ route_raw => $route,
+ route => \@via,
+ route_end => $dest,
+ platform => $platform,
+ info_raw => $info,
+ routeinfo_raw => $routeinfo,
)
);
}