summaryrefslogtreecommitdiff
path: root/lib/Travel/Status/DE/IRIS.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Travel/Status/DE/IRIS.pm')
-rw-r--r--lib/Travel/Status/DE/IRIS.pm11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/Travel/Status/DE/IRIS.pm b/lib/Travel/Status/DE/IRIS.pm
index 7cb35ea..16883a4 100644
--- a/lib/Travel/Status/DE/IRIS.pm
+++ b/lib/Travel/Status/DE/IRIS.pm
@@ -53,6 +53,9 @@ sub new {
$dt_req->add( hours => 1 );
}
+ @{ $self->{results} }
+ = sort { $a->{datetime} <=> $b->{datetime} } @{ $self->{results} };
+
return $self;
}
@@ -60,9 +63,6 @@ sub get_timetable {
my ( $self, $eva, $dt ) = @_;
my $ua = $self->{user_agent};
- say $dt->strftime(
- "http://iris.noncd.db.de/iris-tts/timetable/plan/${eva}/%y%m%d/%H");
-
my $res = $ua->get(
$dt->strftime(
"http://iris.noncd.db.de/iris-tts/timetable/plan/${eva}/%y%m%d/%H")
@@ -75,6 +75,8 @@ sub get_timetable {
my $xml = XML::LibXML->load_xml( string => $res->decoded_content );
+ my $station = ( $xml->findnodes('/timetable') )[0]->getAttribute('station');
+
for my $s ( $xml->findnodes('/timetable/s') ) {
my $id = $s->getAttribute('id');
my $e_tl = ( $s->findnodes('./tl') )[0];
@@ -92,6 +94,7 @@ sub get_timetable {
train_no => $e_tl->getAttribute('n'), # dep number
type => $e_tl->getAttribute('c'), # S/ICE/ERB/...
line_no => $e_tl->getAttribute('l'), # 1 -> S1, ...
+ station => $station,
unknown_o => $e_tl->getAttribute('o'), # owner: 03/80/R2/...
);
@@ -115,8 +118,6 @@ sub get_timetable {
);
}
- say $xml->toString(1);
-
return $self;
}