diff options
author | Daniel Friesel <derf@finalrewind.org> | 2011-06-27 15:57:01 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2011-06-27 15:57:01 +0200 |
commit | c84ddac4286d2c5d92bf6c7dd789c978083cc988 (patch) | |
tree | 08215801c65c26750b9c9fa23efab399fb63ebb9 /lib | |
parent | 4c775f67d3dad7bb45442f315a1d914ae47f34a2 (diff) |
Support arrivals as well as departures
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Travel/Status/DE/DeutscheBahn.pm | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/Travel/Status/DE/DeutscheBahn.pm b/lib/Travel/Status/DE/DeutscheBahn.pm index 8407394..447715e 100644 --- a/lib/Travel/Status/DE/DeutscheBahn.pm +++ b/lib/Travel/Status/DE/DeutscheBahn.pm @@ -42,7 +42,7 @@ sub new { time => $conf{time} || $time, REQTrain_name => q{}, start => 'Suchen', - boardType => 'dep', + boardType => $conf{mode} // 'dep', }, }; @@ -83,9 +83,10 @@ sub new_from_html { sub departures { my ($self) = @_; + my $mode = $self->{post}->{boardType}; my $xp_element = XML::LibXML::XPathExpression->new( - '//table[@class="result stboard dep"]/tr'); + "//table[\@class=\"result stboard ${mode}\"]/tr"); my $xp_time = XML::LibXML::XPathExpression->new('./td[@class="time"]'); my $xp_train = XML::LibXML::XPathExpression->new('./td[@class="train"]'); my $xp_route = XML::LibXML::XPathExpression->new('./td[@class="route"]'); @@ -217,6 +218,14 @@ Date to report for. Defaults to the current day. Time to report for. Defaults to now. +=item B<mode> => B<arr>|B<dep> + +By default, Travel::Status::DE::DeutscheBahn reports train departures +(B<dep>). Set this to B<arr> to get arrivals instead. + +For arrivals, the C<departures()> method will report the arrival time, the +train's origin and their route until the selected I<station>. + =item B<mot> => I<\%hashref> Modes of transport to show. Accepted keys are: B<ice> (ICE trains), B<ic_ec> @@ -256,8 +265,7 @@ None. =head1 BUGS AND LIMITATIONS -The web interface also offers arrival monitoring. This is not yet supported -in this module. +Unknown. =head1 SEE ALSO |