summaryrefslogtreecommitdiff
path: root/bin/db-ris
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2011-07-13 13:33:17 +0200
committerDaniel Friesel <derf@finalrewind.org>2011-07-13 13:33:17 +0200
commitd0f1eccd06746b602fcc468a6d14465c0195004d (patch)
treee41632f726a52b3c7c4504b91f21d7dca7b27ed5 /bin/db-ris
parent10687196f1f39d01c17a415898758b3a65608396 (diff)
DeutscheBahn/Result: Add route_interesting accessor
Diffstat (limited to 'bin/db-ris')
-rwxr-xr-xbin/db-ris42
1 files changed, 2 insertions, 40 deletions
diff --git a/bin/db-ris b/bin/db-ris
index 962b5cd..d787073 100755
--- a/bin/db-ris
+++ b/bin/db-ris
@@ -84,47 +84,9 @@ sub display_result {
return;
}
-sub filter_via {
- my (@via) = @_;
-
- my ( @via_main, @via_show, $last_stop );
-
- for my $stop (@via) {
- if ( $stop =~ m{ ?Hbf} ) {
- push( @via_main, $stop );
- }
- }
- $last_stop = pop(@via);
-
- if ( @via_main and @via and $via[0] eq $via_main[0] ) {
- shift(@via_main);
- }
-
- if ( @via < 3 ) {
- @via_show = @via;
- }
- else {
- @via_show = splice( @via, 0, ( @via_main > 2 ? 1 : 3 - @via_main ) );
-
- while ( @via_show < 3 and @via_main ) {
- my $stop = shift(@via_main);
- if ( $stop ~~ \@via_show or $stop eq $last_stop ) {
- next;
- }
- push( @via_show, $stop );
- }
- }
-
- for my $stop (@via_show) {
- $stop =~ s{ ?Hbf}{};
- }
-
- return @via_show;
-}
-
for my $d ( $status->results() ) {
- my ( @via, @via_main, @via_show );
+ my @via;
my $re_late = qr{ (?: ^ | , ) ca[.] \s \d+ \s Minuten \s sp.ter}ox;
@@ -142,7 +104,7 @@ for my $d ( $status->results() ) {
@output,
[
$d->time, $d->train,
- join( q{ }, filter_via(@via) ), $d->destination,
+ join( q{ }, $d->route_interesting ), $d->destination,
$d->platform, $d->info,
]
);