diff options
Diffstat (limited to 'lib/Travel/Status/DE')
-rw-r--r-- | lib/Travel/Status/DE/IRIS.pm | 5 | ||||
-rw-r--r-- | lib/Travel/Status/DE/IRIS/Result.pm | 25 |
2 files changed, 24 insertions, 6 deletions
diff --git a/lib/Travel/Status/DE/IRIS.pm b/lib/Travel/Status/DE/IRIS.pm index 28441e4..95194ff 100644 --- a/lib/Travel/Status/DE/IRIS.pm +++ b/lib/Travel/Status/DE/IRIS.pm @@ -29,7 +29,7 @@ sub new { datetime => $opt{datetime} // DateTime->now( time_zone => 'Europe/Berlin' ), developer_mode => $opt{developer_mode}, - iris_base => $opt{iris_base} + iris_base => $opt{iris_base} // 'http://iris.noncd.db.de/iris-tts/timetable', lookahead => $opt{lookahead} // ( 4 * 60 ), serializable => $opt{serializable}, @@ -231,6 +231,9 @@ sub get_realtime { if ( not $result ) { $result = $self->add_result( $station, $s ); + if ($result) { + $result->set_unscheduled(1); + } } if ( not $result ) { next; diff --git a/lib/Travel/Status/DE/IRIS/Result.pm b/lib/Travel/Status/DE/IRIS/Result.pm index 80319b5..82659b3 100644 --- a/lib/Travel/Status/DE/IRIS/Result.pm +++ b/lib/Travel/Status/DE/IRIS/Result.pm @@ -95,11 +95,12 @@ my %translation = ( ); Travel::Status::DE::IRIS::Result->mk_ro_accessors( - qw(arrival classes date datetime delay departure is_cancelled is_transfer is_wing - 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 wing_id) + qw(arrival classes date datetime delay departure is_cancelled is_transfer + is_unscheduled is_wing 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 wing_id) ); sub new { @@ -326,6 +327,12 @@ sub set_tl { return $self; } +sub set_unscheduled { + my ( $self, $unscheduled ) = @_; + + $self->{is_unscheduled} = $unscheduled; +} + sub add_arrival_wingref { my ( $self, $ref ) = @_; @@ -821,6 +828,14 @@ the results and indicates it by setting B<is_transfer> to a true value. In case of a transfer, B<train_id> and B<train_no> are set to the "new" value, the old ones are available in B<old_train_id> and B<old_train_no>. +=item $result->is_unscheduled + +True if the train does not appear in the requested plans. This can happen +because of two reasons: Either the scheduled time and the actual time are so +far apart that it should've arrived/departed long ago, or it really is an +unscheduled train. In that case, it can be a replacement or an additional +train. There is no logic to distinguish these cases yet. + =item $result->is_wing Returns true if this result is a wing, false otherwise. |