summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2014-01-10 10:28:08 +0100
committerDaniel Friesel <derf@finalrewind.org>2014-01-10 10:28:08 +0100
commitc256bbc332db21474c3e2019ee982b99ec5a7e5b (patch)
tree6c70db1584efdba68474555432ac3166370bd474
parent312026a5989cb3fe71947990279a1af577f6c85a (diff)
Result.pm: Put realtime data inte route*, add sched_route* for timetable
-rw-r--r--lib/Travel/Status/DE/IRIS/Result.pm62
1 files changed, 56 insertions, 6 deletions
diff --git a/lib/Travel/Status/DE/IRIS/Result.pm b/lib/Travel/Status/DE/IRIS/Result.pm
index 3b8ab48..016393d 100644
--- a/lib/Travel/Status/DE/IRIS/Result.pm
+++ b/lib/Travel/Status/DE/IRIS/Result.pm
@@ -18,7 +18,7 @@ our $VERSION = '0.00';
Travel::Status::DE::IRIS::Result->mk_ro_accessors(
qw(arrival date datetime delay departure is_cancelled line_no platform raw_id
realtime_xml route_start route_end
- sched_arrival sched_departure
+ sched_arrival sched_departure sched_route_start sched_route_end
start stop_no time train_id train_no type unknown_t unknown_o)
);
@@ -98,6 +98,11 @@ sub add_ar {
->in_units('minutes');
}
+ if ( $attrib{route_pre} ) {
+ $self->{route_pre} = [ split( qr{[|]}, $attrib{route_pre} // q{} ) ];
+ $self->{route_start} = $self->{route_pre}[0];
+ }
+
if ( $attrib{status} and $attrib{status} eq 'c' ) {
$self->{is_cancelled} = 1;
}
@@ -120,6 +125,11 @@ sub add_dp {
->in_units('minutes');
}
+ if ( $attrib{route_post} ) {
+ $self->{route_post} = [ split( qr{[|]}, $attrib{route_post} // q{} ) ];
+ $self->{route_end} = $self->{route_post}[-1];
+ }
+
if ( $attrib{status} and $attrib{status} eq 'c' ) {
$self->{is_cancelled} = 1;
}
@@ -256,6 +266,25 @@ sub route_interesting {
}
+sub sched_route_pre {
+ my ($self) = @_;
+
+ return @{ $self->{sched_route_pre} };
+}
+
+sub sched_route_post {
+ my ($self) = @_;
+
+ return @{ $self->{sched_route_post} };
+}
+
+sub sched_route {
+ my ($self) = @_;
+
+ return ( $self->sched_route_pre, $self->{station},
+ $self->sched_route_post );
+}
+
sub translate_msg {
my ( $self, $msg ) = @_;
@@ -456,25 +485,25 @@ not contain realtime data.
=item $result->route_end
-Name of the last station served by this train according to its schedule.
+Name of the last station served by this train.
=item $result->route_interesting
List of up to three "interesting" stations served by this train, subset of
route_post. Usually contains the next stop and one or two major stations after
-that.
+that. Does not contain realtime data.
=item $result->route_pre
-List of station names the train is scheduled to pass before this stop.
+List of station names the train passed (or will have passed) befoe this stop.
=item $result->route_post
-List of station names the train is scheduled to pass after this stop.
+List of station names the train will pass after this stop.
=item $result->route_start
-Name of the first station served by this train according to its schedule.
+Name of the first station served by this train.
=item $result->sched_arrival
@@ -486,6 +515,27 @@ train starts here.
DateTime(3pm) object for the scehduled departure date and time. undef if the
train ends here.
+=item $result->sched_route
+
+List of all stations served by this train, according to its schedule. Does
+not contain realtime data.
+
+=item $result->sched_route_end
+
+Name of the last station served by this train according to its schedule.
+
+=item $result->sched_route_pre
+
+List of station names the train is scheduled to pass before this stop.
+
+=item $result->sched_route_post
+
+List of station names the train is scheduled to pass after this stop.
+
+=item $result->sched_route_start
+
+Name of the first station served by this train according to its schedule.
+
=item $result->start
DateTime(3pm) object for the scheduled start of the train on its route