summaryrefslogtreecommitdiff
path: root/lib/Travel/Status/DE
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2011-12-03 02:12:00 +0100
committerDaniel Friesel <derf@finalrewind.org>2011-12-03 02:12:00 +0100
commit5e436d356b026e06ed29163791a04b3820cf6c05 (patch)
treeec7e5702b6c066c7f502453e1b5e5b17efb2cdf7 /lib/Travel/Status/DE
parent6ee62b87a668e4b3947440bb4dcd298bd4376e10 (diff)
Result: Add ->date accessor
Diffstat (limited to 'lib/Travel/Status/DE')
-rw-r--r--lib/Travel/Status/DE/DeutscheBahn.pm16
-rw-r--r--lib/Travel/Status/DE/DeutscheBahn/Result.pm2
2 files changed, 16 insertions, 2 deletions
diff --git a/lib/Travel/Status/DE/DeutscheBahn.pm b/lib/Travel/Status/DE/DeutscheBahn.pm
index 4e9004d..8d98138 100644
--- a/lib/Travel/Status/DE/DeutscheBahn.pm
+++ b/lib/Travel/Status/DE/DeutscheBahn.pm
@@ -43,8 +43,10 @@ sub new {
date => $conf{date} || $date,
time => $conf{time} || $time,
REQTrain_name => q{},
- start => 'Suchen',
+ start => 'yes',
boardType => $conf{mode} // 'dep',
+ maxJourneys => 20,
+# L => 'vs_java3',
},
};
@@ -153,6 +155,10 @@ sub results {
my $xp_element = XML::LibXML::XPathExpression->new(
"//table[\@class = \"result stboard ${mode}\"]/tr");
+ my $xp_train_more = XML::LibXML::XPathExpression->new('./td[3]/a');
+
+ # bhftafel.exe is not y2k1-safe
+ my $re_morelink = qr{ date = (?<date> .. [.] .. [.] .. ) }x;
my @parts = (
[ 'time', './td[@class="time"]' ],
@@ -186,11 +192,18 @@ sub results {
my $first = 1;
my ( $time, $train, $route, $dest, $platform, $info )
= map { get_node( $tr, @{$_} ) } @parts;
+ my $e_train_more = ($tr->findnodes($xp_train_more))[0];
if ( not( $time and $dest ) ) {
next;
}
+ $e_train_more->getAttribute('href') =~ $re_morelink;
+
+ my $date = $+{date};
+
+ substr($date, 6, 0) = '20';
+
$platform //= q{};
$info //= q{};
@@ -217,6 +230,7 @@ sub results {
push(
@{ $self->{results} },
Travel::Status::DE::DeutscheBahn::Result->new(
+ date => $date,
time => $time,
train => $train,
route_raw => $route,
diff --git a/lib/Travel/Status/DE/DeutscheBahn/Result.pm b/lib/Travel/Status/DE/DeutscheBahn/Result.pm
index 0175e03..87cd84b 100644
--- a/lib/Travel/Status/DE/DeutscheBahn/Result.pm
+++ b/lib/Travel/Status/DE/DeutscheBahn/Result.pm
@@ -9,7 +9,7 @@ use parent 'Class::Accessor';
our $VERSION = '1.00';
Travel::Status::DE::DeutscheBahn::Result->mk_ro_accessors(
- qw(time train route_end route_raw platform info_raw));
+ qw(date time train route_end route_raw platform info_raw));
sub new {
my ( $obj, %conf ) = @_;