Loading bin/hafas +2 −2 Original line number Original line Diff line number Diff line Loading @@ -332,7 +332,7 @@ for my $res ( $hafas->connections ) { "%-5s %-${have_delay}s ab %s%s%s\n", "%-5s %-${have_delay}s ab %s%s%s\n", $sec->dep_cancelled $sec->dep_cancelled ? '--:--' ? '--:--' : $sec->dep_datetime->strftime('%H:%M'), : $sec->dep->strftime('%H:%M'), format_delay( $sec->dep_delay ), format_delay( $sec->dep_delay ), $sec->dep_loc->name, $sec->dep_loc->name, $sec->dep_platform ? q{: } : q{}, $sec->dep_platform ? q{: } : q{}, Loading @@ -342,7 +342,7 @@ for my $res ( $hafas->connections ) { "%-5s %-${have_delay}s an %s%s%s\n", "%-5s %-${have_delay}s an %s%s%s\n", $sec->arr_cancelled $sec->arr_cancelled ? '--:--' ? '--:--' : $sec->arr_datetime->strftime('%H:%M'), : $sec->arr->strftime('%H:%M'), format_delay( $sec->arr_delay ), format_delay( $sec->arr_delay ), $sec->arr_loc->name, $sec->arr_loc->name, $sec->arr_platform ? q{: } : q{}, $sec->arr_platform ? q{: } : q{}, Loading lib/Travel/Routing/DE/HAFAS.pm +2 −2 Original line number Original line Diff line number Diff line Loading @@ -648,9 +648,9 @@ Travel::Routing::DE::HAFAS - Interface to HAFAS itinerary services if ( $sec->type eq 'JNY' ) { if ( $sec->type eq 'JNY' ) { printf("%s -> %s\n%s ab %s\n%s an %s\n\n", printf("%s -> %s\n%s ab %s\n%s an %s\n\n", $sec->name, $sec->direction, $sec->name, $sec->direction, $sec->dep_datetime->strftime('%H:%M'), $sec->dep->strftime('%H:%M'), $sec->dep_loc->name, $sec->dep_loc->name, $sec->arr_datetime->strftime('%H:%M'), $sec->arr->strftime('%H:%M'), $sec->arr_loc->name, $sec->arr_loc->name, ); ); } } Loading lib/Travel/Routing/DE/HAFAS/Connection.pm +5 −5 Original line number Original line Diff line number Diff line Loading @@ -14,7 +14,7 @@ use Travel::Routing::DE::HAFAS::Connection::Section; our $VERSION = '0.00'; our $VERSION = '0.00'; Travel::Routing::DE::HAFAS::Connection->mk_ro_accessors( Travel::Routing::DE::HAFAS::Connection->mk_ro_accessors( qw(changes duration sched_dep rt_dep sched_arr rt_arr dep_datetime arr_datetime dep_platform arr_platform dep_loc arr_loc dep_cancelled arr_cancelled is_cancelled load) qw(changes duration sched_dep rt_dep sched_arr rt_arr dep arr dep_platform arr_platform dep_loc arr_loc dep_cancelled arr_cancelled is_cancelled load) ); ); # {{{ Constructor # {{{ Constructor Loading Loading @@ -119,8 +119,8 @@ sub new { dep_cancelled => $dep_cancelled, dep_cancelled => $dep_cancelled, arr_cancelled => $arr_cancelled, arr_cancelled => $arr_cancelled, is_cancelled => $is_cancelled, is_cancelled => $is_cancelled, dep_datetime => $rt_dep // $sched_dep, dep => $rt_dep // $sched_dep, arr_datetime => $rt_arr // $sched_arr, arr => $rt_arr // $sched_arr, dep_platform => $connection->{dep}{dPlatfR} dep_platform => $connection->{dep}{dPlatfR} // $connection->{dep}{dPlatfS}, // $connection->{dep}{dPlatfS}, arr_platform => $connection->{arr}{aPlatfR} arr_platform => $connection->{arr}{aPlatfR} Loading Loading @@ -201,7 +201,7 @@ individual parts of the connection. True if the arrival of the last section in this connection has been cancelled, True if the arrival of the last section in this connection has been cancelled, false otherwise. false otherwise. =item $connection->arr_datetime =item $connection->arr DateTime(3pm) object holding the arrival time and date. Based on real-time data DateTime(3pm) object holding the arrival time and date. Based on real-time data if available, falls back to schedule data otherwise. if available, falls back to schedule data otherwise. Loading @@ -223,7 +223,7 @@ Number of changes between different modes of transport. True if the departure of the first section in this connection has been True if the departure of the first section in this connection has been cancelled, false otherwise. cancelled, false otherwise. =item $connection->dep_datetime =item $connection->dep DateTime(3pm) object holding the departure time and date. Based on real-time DateTime(3pm) object holding the departure time and date. Based on real-time data if available, falls back to schedule data otherwise. data if available, falls back to schedule data otherwise. Loading lib/Travel/Routing/DE/HAFAS/Connection/Section.pm +17 −9 Original line number Original line Diff line number Diff line Loading @@ -13,7 +13,7 @@ use Travel::Routing::DE::HAFAS::Utils; our $VERSION = '0.00'; our $VERSION = '0.00'; Travel::Routing::DE::HAFAS::Connection::Section->mk_ro_accessors( Travel::Routing::DE::HAFAS::Connection::Section->mk_ro_accessors( qw(type schep_dep rt_dep sched_arr rt_arr dep_datetime arr_datetime arr_delay dep_delay journey distance duration transfer_duration dep_loc arr_loc qw(type schep_dep rt_dep sched_arr rt_arr dep arr arr_delay dep_delay journey distance duration transfer_duration dep_loc arr_loc dep_platform arr_platform dep_cancelled arr_cancelled dep_platform arr_platform dep_cancelled arr_cancelled operator id name category category_long class number line line_no load delay direction) operator id name category category_long class number line line_no load delay direction) ); ); Loading Loading @@ -72,14 +72,17 @@ sub new { } } } } # TODO load # TODO operator my $ref = { my $ref = { type => $sec->{type}, type => $sec->{type}, sched_dep => $sched_dep, sched_dep => $sched_dep, rt_dep => $rt_dep, rt_dep => $rt_dep, sched_arr => $sched_arr, sched_arr => $sched_arr, rt_arr => $rt_arr, rt_arr => $rt_arr, dep_datetime => $rt_dep // $sched_dep, dep => $rt_dep // $sched_dep, arr_datetime => $rt_arr // $sched_arr, arr => $rt_arr // $sched_arr, dep_loc => $locs->[ $sec->{dep}{locX} ], dep_loc => $locs->[ $sec->{dep}{locX} ], arr_loc => $locs->[ $sec->{arr}{locX} ], arr_loc => $locs->[ $sec->{arr}{locX} ], dep_platform => $sec->{dep}{dplatfR} // $sec->{dep}{dPlatfS}, dep_platform => $sec->{dep}{dplatfR} // $sec->{dep}{dPlatfS}, Loading @@ -99,7 +102,6 @@ sub new { if ( $sec->{type} eq 'JNY' ) { if ( $sec->{type} eq 'JNY' ) { #operator id name type type_long class number line line_no load delay direction) my $journey = $sec->{jny}; my $journey = $sec->{jny}; my $product = $prodL[ $journey->{prodX} ]; my $product = $prodL[ $journey->{prodX} ]; $ref->{id} = $journey->{jid}; $ref->{id} = $journey->{jid}; Loading @@ -119,6 +121,12 @@ sub new { { { $ref->{name} .= ' ' . $product->{nameS}; $ref->{name} .= ' ' . $product->{nameS}; } } my @stops; for my $stop ( @{ $journey->{stopL} // [] } ) { my $loc = $locs->[ $stop->{locX} ]; say $loc->name; } } } elsif ( $sec->{type} eq 'WALK' ) { elsif ( $sec->{type} eq 'WALK' ) { $ref->{distance} = $sec->{gis}{dist}; $ref->{distance} = $sec->{gis}{dist}; Loading @@ -142,7 +150,7 @@ sub new { sub set_transfer_from_previous_section { sub set_transfer_from_previous_section { my ( $self, $prev_sec ) = @_; my ( $self, $prev_sec ) = @_; my $delta = $self->dep_datetime - $prev_sec->arr_datetime; my $delta = $self->dep - $prev_sec->arr; $self->{transfer_duration} = $delta; $self->{transfer_duration} = $delta; } } Loading Loading @@ -175,9 +183,9 @@ Travel::Routing::DE::HAFAS::Connection::Section - A single trip between two stop for my $sec ( $connection->sections ) { for my $sec ( $connection->sections ) { printf("%s -> %s\n%s ab %s\n%s an %s\n\n", printf("%s -> %s\n%s ab %s\n%s an %s\n\n", $sec->name, $sec->direction, $sec->name, $sec->direction, $sec->dep_datetime->strftime('%H:%M'), $sec->dep->strftime('%H:%M'), $sec->dep_loc->name, $sec->dep_loc->name, $sec->arr_datetime->strftime('%H:%M'), $sec->arr->strftime('%H:%M'), $sec->arr_loc->name, $sec->arr_loc->name, ); ); } } Loading Loading @@ -207,7 +215,7 @@ in which they are valid and return undef when called in other contexts. True if the arrival at the end of this section has been cancelled. True if the arrival at the end of this section has been cancelled. False otherwise. False otherwise. =item $section->arr_datetime =item $section->arr DateTime(3pm) object holding the arrival time and date. Based on real-time data DateTime(3pm) object holding the arrival time and date. Based on real-time data if available, falls back to schedule data otherwise. if available, falls back to schedule data otherwise. Loading @@ -229,7 +237,7 @@ Arrival platform as string, not necessarily numeric. Undef if unknown. True if the departure at the start of this section has been cancelled. True if the departure at the start of this section has been cancelled. False otherwise. False otherwise. =item $section->dep_datetime =item $section->dep DateTime(3pm) object holding the departure time and date. Based on real-time DateTime(3pm) object holding the departure time and date. Based on real-time data if available, falls back to schedule data otherwise. data if available, falls back to schedule data otherwise. Loading Loading
bin/hafas +2 −2 Original line number Original line Diff line number Diff line Loading @@ -332,7 +332,7 @@ for my $res ( $hafas->connections ) { "%-5s %-${have_delay}s ab %s%s%s\n", "%-5s %-${have_delay}s ab %s%s%s\n", $sec->dep_cancelled $sec->dep_cancelled ? '--:--' ? '--:--' : $sec->dep_datetime->strftime('%H:%M'), : $sec->dep->strftime('%H:%M'), format_delay( $sec->dep_delay ), format_delay( $sec->dep_delay ), $sec->dep_loc->name, $sec->dep_loc->name, $sec->dep_platform ? q{: } : q{}, $sec->dep_platform ? q{: } : q{}, Loading @@ -342,7 +342,7 @@ for my $res ( $hafas->connections ) { "%-5s %-${have_delay}s an %s%s%s\n", "%-5s %-${have_delay}s an %s%s%s\n", $sec->arr_cancelled $sec->arr_cancelled ? '--:--' ? '--:--' : $sec->arr_datetime->strftime('%H:%M'), : $sec->arr->strftime('%H:%M'), format_delay( $sec->arr_delay ), format_delay( $sec->arr_delay ), $sec->arr_loc->name, $sec->arr_loc->name, $sec->arr_platform ? q{: } : q{}, $sec->arr_platform ? q{: } : q{}, Loading
lib/Travel/Routing/DE/HAFAS.pm +2 −2 Original line number Original line Diff line number Diff line Loading @@ -648,9 +648,9 @@ Travel::Routing::DE::HAFAS - Interface to HAFAS itinerary services if ( $sec->type eq 'JNY' ) { if ( $sec->type eq 'JNY' ) { printf("%s -> %s\n%s ab %s\n%s an %s\n\n", printf("%s -> %s\n%s ab %s\n%s an %s\n\n", $sec->name, $sec->direction, $sec->name, $sec->direction, $sec->dep_datetime->strftime('%H:%M'), $sec->dep->strftime('%H:%M'), $sec->dep_loc->name, $sec->dep_loc->name, $sec->arr_datetime->strftime('%H:%M'), $sec->arr->strftime('%H:%M'), $sec->arr_loc->name, $sec->arr_loc->name, ); ); } } Loading
lib/Travel/Routing/DE/HAFAS/Connection.pm +5 −5 Original line number Original line Diff line number Diff line Loading @@ -14,7 +14,7 @@ use Travel::Routing::DE::HAFAS::Connection::Section; our $VERSION = '0.00'; our $VERSION = '0.00'; Travel::Routing::DE::HAFAS::Connection->mk_ro_accessors( Travel::Routing::DE::HAFAS::Connection->mk_ro_accessors( qw(changes duration sched_dep rt_dep sched_arr rt_arr dep_datetime arr_datetime dep_platform arr_platform dep_loc arr_loc dep_cancelled arr_cancelled is_cancelled load) qw(changes duration sched_dep rt_dep sched_arr rt_arr dep arr dep_platform arr_platform dep_loc arr_loc dep_cancelled arr_cancelled is_cancelled load) ); ); # {{{ Constructor # {{{ Constructor Loading Loading @@ -119,8 +119,8 @@ sub new { dep_cancelled => $dep_cancelled, dep_cancelled => $dep_cancelled, arr_cancelled => $arr_cancelled, arr_cancelled => $arr_cancelled, is_cancelled => $is_cancelled, is_cancelled => $is_cancelled, dep_datetime => $rt_dep // $sched_dep, dep => $rt_dep // $sched_dep, arr_datetime => $rt_arr // $sched_arr, arr => $rt_arr // $sched_arr, dep_platform => $connection->{dep}{dPlatfR} dep_platform => $connection->{dep}{dPlatfR} // $connection->{dep}{dPlatfS}, // $connection->{dep}{dPlatfS}, arr_platform => $connection->{arr}{aPlatfR} arr_platform => $connection->{arr}{aPlatfR} Loading Loading @@ -201,7 +201,7 @@ individual parts of the connection. True if the arrival of the last section in this connection has been cancelled, True if the arrival of the last section in this connection has been cancelled, false otherwise. false otherwise. =item $connection->arr_datetime =item $connection->arr DateTime(3pm) object holding the arrival time and date. Based on real-time data DateTime(3pm) object holding the arrival time and date. Based on real-time data if available, falls back to schedule data otherwise. if available, falls back to schedule data otherwise. Loading @@ -223,7 +223,7 @@ Number of changes between different modes of transport. True if the departure of the first section in this connection has been True if the departure of the first section in this connection has been cancelled, false otherwise. cancelled, false otherwise. =item $connection->dep_datetime =item $connection->dep DateTime(3pm) object holding the departure time and date. Based on real-time DateTime(3pm) object holding the departure time and date. Based on real-time data if available, falls back to schedule data otherwise. data if available, falls back to schedule data otherwise. Loading
lib/Travel/Routing/DE/HAFAS/Connection/Section.pm +17 −9 Original line number Original line Diff line number Diff line Loading @@ -13,7 +13,7 @@ use Travel::Routing::DE::HAFAS::Utils; our $VERSION = '0.00'; our $VERSION = '0.00'; Travel::Routing::DE::HAFAS::Connection::Section->mk_ro_accessors( Travel::Routing::DE::HAFAS::Connection::Section->mk_ro_accessors( qw(type schep_dep rt_dep sched_arr rt_arr dep_datetime arr_datetime arr_delay dep_delay journey distance duration transfer_duration dep_loc arr_loc qw(type schep_dep rt_dep sched_arr rt_arr dep arr arr_delay dep_delay journey distance duration transfer_duration dep_loc arr_loc dep_platform arr_platform dep_cancelled arr_cancelled dep_platform arr_platform dep_cancelled arr_cancelled operator id name category category_long class number line line_no load delay direction) operator id name category category_long class number line line_no load delay direction) ); ); Loading Loading @@ -72,14 +72,17 @@ sub new { } } } } # TODO load # TODO operator my $ref = { my $ref = { type => $sec->{type}, type => $sec->{type}, sched_dep => $sched_dep, sched_dep => $sched_dep, rt_dep => $rt_dep, rt_dep => $rt_dep, sched_arr => $sched_arr, sched_arr => $sched_arr, rt_arr => $rt_arr, rt_arr => $rt_arr, dep_datetime => $rt_dep // $sched_dep, dep => $rt_dep // $sched_dep, arr_datetime => $rt_arr // $sched_arr, arr => $rt_arr // $sched_arr, dep_loc => $locs->[ $sec->{dep}{locX} ], dep_loc => $locs->[ $sec->{dep}{locX} ], arr_loc => $locs->[ $sec->{arr}{locX} ], arr_loc => $locs->[ $sec->{arr}{locX} ], dep_platform => $sec->{dep}{dplatfR} // $sec->{dep}{dPlatfS}, dep_platform => $sec->{dep}{dplatfR} // $sec->{dep}{dPlatfS}, Loading @@ -99,7 +102,6 @@ sub new { if ( $sec->{type} eq 'JNY' ) { if ( $sec->{type} eq 'JNY' ) { #operator id name type type_long class number line line_no load delay direction) my $journey = $sec->{jny}; my $journey = $sec->{jny}; my $product = $prodL[ $journey->{prodX} ]; my $product = $prodL[ $journey->{prodX} ]; $ref->{id} = $journey->{jid}; $ref->{id} = $journey->{jid}; Loading @@ -119,6 +121,12 @@ sub new { { { $ref->{name} .= ' ' . $product->{nameS}; $ref->{name} .= ' ' . $product->{nameS}; } } my @stops; for my $stop ( @{ $journey->{stopL} // [] } ) { my $loc = $locs->[ $stop->{locX} ]; say $loc->name; } } } elsif ( $sec->{type} eq 'WALK' ) { elsif ( $sec->{type} eq 'WALK' ) { $ref->{distance} = $sec->{gis}{dist}; $ref->{distance} = $sec->{gis}{dist}; Loading @@ -142,7 +150,7 @@ sub new { sub set_transfer_from_previous_section { sub set_transfer_from_previous_section { my ( $self, $prev_sec ) = @_; my ( $self, $prev_sec ) = @_; my $delta = $self->dep_datetime - $prev_sec->arr_datetime; my $delta = $self->dep - $prev_sec->arr; $self->{transfer_duration} = $delta; $self->{transfer_duration} = $delta; } } Loading Loading @@ -175,9 +183,9 @@ Travel::Routing::DE::HAFAS::Connection::Section - A single trip between two stop for my $sec ( $connection->sections ) { for my $sec ( $connection->sections ) { printf("%s -> %s\n%s ab %s\n%s an %s\n\n", printf("%s -> %s\n%s ab %s\n%s an %s\n\n", $sec->name, $sec->direction, $sec->name, $sec->direction, $sec->dep_datetime->strftime('%H:%M'), $sec->dep->strftime('%H:%M'), $sec->dep_loc->name, $sec->dep_loc->name, $sec->arr_datetime->strftime('%H:%M'), $sec->arr->strftime('%H:%M'), $sec->arr_loc->name, $sec->arr_loc->name, ); ); } } Loading Loading @@ -207,7 +215,7 @@ in which they are valid and return undef when called in other contexts. True if the arrival at the end of this section has been cancelled. True if the arrival at the end of this section has been cancelled. False otherwise. False otherwise. =item $section->arr_datetime =item $section->arr DateTime(3pm) object holding the arrival time and date. Based on real-time data DateTime(3pm) object holding the arrival time and date. Based on real-time data if available, falls back to schedule data otherwise. if available, falls back to schedule data otherwise. Loading @@ -229,7 +237,7 @@ Arrival platform as string, not necessarily numeric. Undef if unknown. True if the departure at the start of this section has been cancelled. True if the departure at the start of this section has been cancelled. False otherwise. False otherwise. =item $section->dep_datetime =item $section->dep DateTime(3pm) object holding the departure time and date. Based on real-time DateTime(3pm) object holding the departure time and date. Based on real-time data if available, falls back to schedule data otherwise. data if available, falls back to schedule data otherwise. Loading