summaryrefslogtreecommitdiff
path: root/index.pl
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2016-08-12 15:53:12 +0200
committerDaniel Friesel <derf@finalrewind.org>2016-08-12 15:53:12 +0200
commit283817ca23d681fc96b2d33a0ce13b8a189ba416 (patch)
tree569c46264eff72d636b54828342516f577ef5c53 /index.pl
parentdb7a25b19f8e8b1fbe89fd65d312ad78ffa9aa35 (diff)
parentf3771b96629934360e8c99ff949a3c523b29fd13 (diff)
Merge branch 'sHorst-master'
Diffstat (limited to 'index.pl')
-rw-r--r--index.pl14
1 files changed, 11 insertions, 3 deletions
diff --git a/index.pl b/index.pl
index aaa0acf..7ac24b6 100644
--- a/index.pl
+++ b/index.pl
@@ -319,6 +319,7 @@ sub handle_request {
my $with_related = $self->param('recursive') // 0;
my $callback = $self->param('callback');
my $apiver = $self->param('version') // 0;
+ my @train_types = split( /,/, $self->param('train_types') // q{} );
my %opt;
my $api_version
@@ -399,9 +400,10 @@ sub handle_request {
}
for my $result (@results) {
- my $platform = ( split( / /, $result->platform ) )[0];
- my $line = $result->line;
- my $delay = $result->delay;
+ my $platform = ( split( / /, $result->platform ) )[0];
+ my $line = $result->line;
+ my $train_type = $result->type;
+ my $delay = $result->delay;
if ( $via and $result->can('route_post') ) {
$via =~ s{ , \s* }{|}gx;
my @route = $result->route_post;
@@ -418,6 +420,12 @@ sub handle_request {
{
next;
}
+ if ( @train_types
+ and
+ not( List::MoreUtils::any { $train_type =~ m{^$_} } @train_types ) )
+ {
+ next;
+ }
if ( $backend eq 'iris' and $admode eq 'arr' and not $result->arrival )
{
next;