Skip to content
GitLab
Explore
Sign in
derf
Travel-Routing-DE-HAFAS
Compare revisions
e7867caf2ef6877dc513f438a6a1fe7d4b7fc5c5 to 05661d3c9c695eb6ec57b1d8fe72e7274289bc27
Commits on Source (2)
Add --max-change / max_change options
· b85f3942
Birte Kristina Friesel
authored
Mar 24, 2024
b85f3942
HAFAS(3pm): remove left-over annotations from T-S-DE-HAFAS
· 05661d3c
Birte Kristina Friesel
authored
Mar 24, 2024
05661d3c
Hide whitespace changes
Inline
Side-by-side
bin/hafas
View file @
05661d3c
...
...
@@ -22,7 +22,8 @@ my ( $json_output, $raw_json_output );
my
$show_full_route
;
my
(
$list_services
,
$service
);
my
(
@excluded_mots
,
@exclusive_mots
);
my
$verbosity
=
0
;
my
$max_change
=
undef
;
my
$verbosity
=
0
;
my
@output
;
my
%min_verbosity
=
(
...
...
@@ -45,6 +46,7 @@ my $output_reset = -t STDOUT ? "\033[0m" : q{};
GetOptions
(
'
a|arrive=s
'
=>
sub
{
$arrival
=
1
;
$time
=
$_
[
1
]
},
'
c|max-change=s
'
=>
\
$max_change
,
'
d|date=s
'
=>
\
$date
,
'
h|help
'
=>
sub
{
show_help
(
0
)
},
'
f|full-route
'
=>
\
$show_full_route
,
...
...
@@ -82,12 +84,13 @@ if ( not $from_stop and $to_stop ) {
}
my
%opt
=
(
excluded_mots
=>
\
@excluded_mots
,
exclusive_mots
=>
\
@exclusive_mots
,
service
=>
$service
,
from_stop
=>
$from_stop
,
to_stop
=>
$to_stop
,
excluded_mots
=>
\
@excluded_mots
,
exclusive_mots
=>
\
@exclusive_mots
,
max_change
=>
$max_change
,
developer_mode
=>
$developer_mode
,
service
=>
$service
,
arrival
=>
$arrival
,
language
=>
$language
,
);
...
...
@@ -468,6 +471,10 @@ between two stops and prints the results.
Request connections that arrive at the destination before I<hh>:I<mm>.
Overrides B<--time> / B<--depart>.
=item B<-c>, B<--max-change> I<count>
Request connections with no more than I<count> changeovers.
=item B<-d>, B<--date> I<dd>.I<mm>.[I<yyyy>]
Planned departure (or arrival) date. Default: today.
...
...
lib/Travel/Routing/DE/HAFAS.pm
View file @
05661d3c
...
...
@@ -253,7 +253,7 @@ sub new {
depLocL
=>
[
{
lid
=>
$from_lid
}
],
arrLocL
=>
[
{
lid
=>
$to_lid
}
],
numF
=>
6
,
maxChg
=>
undef
,
maxChg
=>
$conf
{
max_change
}
,
minChgTime
=>
undef
,
outFrwd
=>
$outFrwd
,
viaLocL
=>
undef
,
...
...
@@ -721,18 +721,18 @@ Store HAFAS replies in the provided cache object. This module works with
real-time data, so the object should be configured for an expiry of one to two
minutes.
=item B<datetime> => I<DateTime object>
(station)
=item B<datetime> => I<DateTime object>
Date and time for itinerary request. Defaults to now.
=item B<excluded_mots> => [I<mot1>, I<mot2>, ...]
(geoSearch, station)
=item B<excluded_mots> => [I<mot1>, I<mot2>, ...]
By default, all modes of transport (trains, trams, buses etc.) are considered.
If this option is set, all modes appearing in I<mot1>, I<mot2>, ... will
be excluded. The supported modes depend on B<service>, use
B<get_services> or B<get_service> to get the supported values.
=item B<exclusive_mots> => [I<mot1>, I<mot2>, ...]
(geoSearch, station)
=item B<exclusive_mots> => [I<mot1>, I<mot2>, ...]
If this option is set, only the modes of transport appearing in I<mot1>,
I<mot2>, ... will be considered. The supported modes depend on B<service>,
...
...
@@ -749,6 +749,10 @@ values. Providing an unsupported or invalid value may lead to garbage output.
Passed on to C<< LWP::UserAgent->new >>. Defaults to C<< { timeout => 10 } >>,
pass an empty hashref to call the LWP::UserAgent constructor without arguments.
=item B<max_change> => I<count>
Request connections with no more than I<count> changeovers.
=item B<service> => I<service>
Request results from I<service>, defaults to "DB".
...
...