diff options
author | Daniel Friesel <derf@finalrewind.org> | 2019-07-14 17:17:44 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2019-07-14 17:17:44 +0200 |
commit | b08b0fb921e7c5dc9afada0cd873b0cf980bd429 (patch) | |
tree | b44095db3fa74176a5a5336727c61065ddbd4f49 /lib/Travelynx.pm | |
parent | 8e5a8fad931052cc50f3f0ec404b480a8e7fcd18 (diff) |
handle ambiguous train numbers when requesting train details1.8.3
Diffstat (limited to 'lib/Travelynx.pm')
-rwxr-xr-x | lib/Travelynx.pm | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/Travelynx.pm b/lib/Travelynx.pm index aee93a5..c502b8c 100755 --- a/lib/Travelynx.pm +++ b/lib/Travelynx.pm @@ -1763,8 +1763,16 @@ sub startup { if ( $suggestion->{depDate} eq $date_yy or $suggestion->{depDate} eq $date_yyyy ) { - $trainlink = $suggestion->{trainLink}; - last; + # Train numbers are not unique, e.g. IC 149 refers both to the + # InterCity service Amsterdam -> Berlin and to the InterCity service + # Koebenhavns Lufthavn st -> Aarhus. One workaround is making + # requests with the stationFilter=80 parameter. Checking the origin + # station seems to be the more generic solution, so we do that + # instead. + if ( $suggestion->{dep} eq $train->origin ) { + $trainlink = $suggestion->{trainLink}; + last; + } } } |