summaryrefslogtreecommitdiff
path: root/lib/Travel/Status/DE
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Travel/Status/DE')
-rw-r--r--lib/Travel/Status/DE/DeutscheBahn.pm18
-rw-r--r--lib/Travel/Status/DE/DeutscheBahn/Result.pm3
2 files changed, 16 insertions, 5 deletions
diff --git a/lib/Travel/Status/DE/DeutscheBahn.pm b/lib/Travel/Status/DE/DeutscheBahn.pm
index 018eaa9..780d05d 100644
--- a/lib/Travel/Status/DE/DeutscheBahn.pm
+++ b/lib/Travel/Status/DE/DeutscheBahn.pm
@@ -21,6 +21,8 @@ sub new {
my $reply;
+ my $lang = $conf{language} // 'd';
+
if ( not $conf{station} ) {
confess('You need to specify a station');
}
@@ -45,7 +47,8 @@ sub new {
REQTrain_name => q{},
start => 'yes',
boardType => $conf{mode} // 'dep',
-# L => 'vs_java3',
+
+ # L => 'vs_java3',
},
};
@@ -57,7 +60,9 @@ sub new {
bless( $ref, $obj );
- $reply = $ua->post( 'http://reiseauskunft.bahn.de/bin/bhftafel.exe/dn?rt=1',
+ $reply
+ = $ua->post(
+ "http://reiseauskunft.bahn.de/bin/bhftafel.exe/${lang}n?rt=1",
$ref->{post} );
if ( $reply->is_error ) {
@@ -191,7 +196,7 @@ sub results {
my $first = 1;
my ( $time, $train, $route, $dest, $platform, $info )
= map { get_node( $tr, @{$_} ) } @parts;
- my $e_train_more = ($tr->findnodes($xp_train_more))[0];
+ my $e_train_more = ( $tr->findnodes($xp_train_more) )[0];
if ( not( $time and $dest ) ) {
next;
@@ -201,7 +206,7 @@ sub results {
my $date = $+{date};
- substr($date, 6, 0) = '20';
+ substr( $date, 6, 0 ) = '20';
$platform //= q{};
$info //= q{};
@@ -311,6 +316,11 @@ The train station to report for, e.g. "Essen HBf". Mandatory.
Date to report for. Defaults to the current day.
+=item B<language> => I<language>
+
+Set language for additional information. Accepted arguments: B<d>eutsch,
+B<e>nglish, B<i>talian, B<n> (dutch).
+
=item B<time> => I<hh>:I<mm>
Time to report for. Defaults to now.
diff --git a/lib/Travel/Status/DE/DeutscheBahn/Result.pm b/lib/Travel/Status/DE/DeutscheBahn/Result.pm
index 53585cf..4860810 100644
--- a/lib/Travel/Status/DE/DeutscheBahn/Result.pm
+++ b/lib/Travel/Status/DE/DeutscheBahn/Result.pm
@@ -38,7 +38,8 @@ sub info {
$info =~ s{ ,Grund }{}ox;
$info =~ s{ ^ \s+ }{}ox;
- $info =~ s{ (?: ^ | , ) (?: p.nktlich | k [.] A [.] ) }{}ox;
+ $info
+ =~ s{ (?: ^ | , ) (?: p.nktlich | [nk] [.] [Aa] [.] | on \s time ) }{}ox;
$info =~ s{ ^ , }{}ox;
return $info;