diff options
author | Daniel Friesel <derf@finalrewind.org> | 2015-10-20 18:12:23 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2015-10-20 18:12:23 +0200 |
commit | 925c9a2ef9ee074f0ed3dff2b0c69c542051cd35 (patch) | |
tree | 3cb592bb75ddd585fed06dcdd17f1e202f3a8131 | |
parent | 2c0a1f463ce56683ca8394f10eee27cbb8ff47f2 (diff) |
add candidates for hafas backends too
-rw-r--r-- | index.pl | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -105,6 +105,9 @@ sub get_results { } else { my $efa_url = 'http://efa.vrr.de/vrr/XSLT_DM_REQUEST'; + if ( not $city ) { + return { errstr => 'City must be specified for this backend' }; + } if ($sub_backend) { my $service = first { lc( $_->{shortname} ) eq lc($sub_backend) } @@ -132,6 +135,13 @@ sub get_results { $data->{name_candidates} = [ $status->name_candidates ]; $data->{place_candidates} = [ $status->place_candidates ]; } + elsif ( $status->errstr + and $status->can('errcode') + and $status->errcode eq 'H730' ) + { + $data->{name_candidates} + = [ map { $_->{name} } $status->similar_stops ]; + } $cache->freeze( $sstr, $data ); } @@ -148,7 +158,7 @@ sub handle_request { my $backend = $self->param('backend') // $default{backend}; my $data; - if ( ( $city and $stop ) or ( $backend eq 'aseag' and $stop ) ) { + if ($stop) { $data = get_results( $self->param('backend') // $default{backend}, $city, $stop ); } |