summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog5
-rwxr-xr-xbin/db-ris12
-rw-r--r--lib/Travel/Status/DE/DeutscheBahn.pm3
3 files changed, 18 insertions, 2 deletions
diff --git a/Changelog b/Changelog
index 211ddb2..3e406e6 100644
--- a/Changelog
+++ b/Changelog
@@ -1,6 +1,11 @@
git HEAD
+ [db-ris]
+ * Only display info when a train is late, not when on time / unknown
+
+ [Travel::Status::DE::DeutscheBahn]
* Proper HTTP request error handling
+ * Strip leading whitespace from ::Result info
Travel::Status::DE::DeutscheBahn 0.01 - Mon Jun 27 2011
diff --git a/bin/db-ris b/bin/db-ris
index 8d1b833..bffe532 100755
--- a/bin/db-ris
+++ b/bin/db-ris
@@ -80,6 +80,16 @@ sub display_result {
return;
}
+sub filter_info {
+ my ($info) = @_;
+
+ if ( $info =~ m{ ^ (?: p.nktlich | k [.] A [.] ) $ }ox ) {
+ return q{};
+ }
+
+ return $info;
+}
+
sub filter_via {
my (@via) = @_;
@@ -133,7 +143,7 @@ for my $d ( $status->results() ) {
[
$d->time, $d->train,
join( q{ }, filter_via(@via) ), $d->destination,
- $d->platform, $d->info
+ $d->platform, filter_info( $d->info )
]
);
}
diff --git a/lib/Travel/Status/DE/DeutscheBahn.pm b/lib/Travel/Status/DE/DeutscheBahn.pm
index 12450b2..be0621d 100644
--- a/lib/Travel/Status/DE/DeutscheBahn.pm
+++ b/lib/Travel/Status/DE/DeutscheBahn.pm
@@ -135,7 +135,8 @@ sub results {
$str =~ tr/ //s;
}
- $info =~ s/,Grund//;
+ $info =~ s{ ,Grund }{}ox;
+ $info =~ s{ ^ \s+ }{}ox;
while ( $route =~ m{$re_via}g ) {
if ($first) {