Commit 56685ea8 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

parse <ref> fields in fchg. not used in db-iris yet.

parent 155ddeee
Loading
Loading
Loading
Loading
+16 −5
Original line number Diff line number Diff line
@@ -196,6 +196,7 @@ sub get_realtime {
		my $e_tl  = ( $s->findnodes('./tl') )[0];
		my $e_ar  = ( $s->findnodes('./ar') )[0];
		my $e_dp  = ( $s->findnodes('./dp') )[0];
		my $e_ref = ( $s->findnodes('./ref') )[0];
		my @e_ms  = $s->findnodes('.//m');

		my %messages;
@@ -234,6 +235,16 @@ sub get_realtime {
				unknown_o => $e_tl->getAttribute('o'),    # owner: 03/80/R2/...
			);
		}
		if ($e_ref) {
			$result->add_ref(
				class     => $e_ref->getAttribute('f'),    # D N S F
				unknown_t => $e_ref->getAttribute('t'),    # p
				train_no  => $e_ref->getAttribute('n'),    # dep number
				type      => $e_ref->getAttribute('c'),    # S/ICE/ERB/...
				line_no   => $e_ref->getAttribute('l'),    # 1 -> S1, ...
				unknown_o => $e_ref->getAttribute('o'),    # owner: 03/80/R2/...
			);
		}
		if ($e_ar) {
			$result->add_ar(
				arrival_ts => $e_ar->getAttribute('ct'),
+23 −4
Original line number Diff line number Diff line
@@ -17,10 +17,10 @@ our $VERSION = '0.03';

Travel::Status::DE::IRIS::Result->mk_ro_accessors(
	qw(arrival classes date datetime delay departure is_cancelled is_transfer
	  line_no old_train_id old_train_no platform raw_id realtime_xml
	  route_start route_end sched_arrival sched_departure sched_platform
	  sched_route_start sched_route_end start stop_no time train_id train_no
	  transfer type unknown_t unknown_o)
	  line_no train_no_transfer old_train_id old_train_no platform raw_id
	  realtime_xml route_start route_end sched_arrival sched_departure
	  sched_platform sched_route_start sched_route_end start stop_no time
	  train_id train_no transfer type unknown_t unknown_o)
);

sub new {
@@ -171,6 +171,16 @@ sub add_realtime {
	return $self;
}

sub add_ref {
	my ( $self, %attrib ) = @_;

	$self->{train_no_transfer} = $attrib{train_no};

	# TODO

	return $self;
}

sub add_tl {
	my ( $self, %attrib ) = @_;

@@ -766,6 +776,15 @@ stations.

Number of this train, unique per day. E.g. C<< 2225 >> for C<< IC 2225 >>.

=item $result->train_no_transfer

Number of this train after a following transfer, undefined if no such transfer
exists. See B<is_transfer> for a note about this.

Note that unlike B<old_train_no>, this information is always based on realtime
data (not included in any schedule) and only set for stations before the
transfer station, not the transfer station itself.

=item $result->type

Type of this train, e.g. C<< S >> for S-Bahn, C<< RE >> for Regional-Express,