Unverified Commit c8d2e129 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

add -j / --with-jid option

parent d9998626
Loading
Loading
Loading
Loading
+11 −6
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@ my $service = 'VRR';
my $efa_url;
my $efa_encoding;
my ( $date,        $time, $input_type, $list_lines, $offset, $relative_times );
my ( $full_routes, $filter_via );
my ( $full_routes, $filter_via, $show_jid );
my ( $timeout,     $developer_mode );
my ( @grep_lines,  @grep_platforms, @grep_mots );
my ( %edata,       @edata_pre );
@@ -31,6 +31,7 @@ GetOptions(
	'd|date=s'                      => \$date,
	'D|discover'                    => \$discover,
	'h|help'                        => sub { show_help(0) },
	'j|with-jid'                    => \$show_jid,
	'l|line=s@'                     => \@grep_lines,
	'L|linelist'                    => \$list_lines,
	'list'                          => \$list_services,
@@ -224,9 +225,9 @@ sub display_result {

	for my $line (@lines) {

		if ( $edata{messages} and $line->[5] and @{ $line->[5] } ) {
		if ( $edata{messages} and $line->[5]->hints ) {
			print "\n";
			for my $hint ( @{ $line->[5] } ) {
			for my $hint ( $line->[5]->hints ) {
				$hint =~ tr{\n\x0d}{ }s;
				chomp $hint;
				say "# ${hint}";
@@ -350,8 +351,12 @@ sub show_results {
			$line = $d->train_type . ' ' . $d->train_no;
		}

		@output_line
		  = ( $dtime, $platform, $line, q{}, $d->destination, [ $d->hints ] );
		@output_line = ( $dtime, $platform, $line, q{}, $d->destination, $d );

		if ($show_jid) {
			$output_line[2]
			  .= sprintf( '  %s@%d@%d', $d->stateless, $d->stop_id, $d->key );
		}

		if ( $edata{route} ) {
			$output_line[3]
+3 −0
Original line number Diff line number Diff line
@@ -510,6 +510,9 @@ sub parse_departure {
		platform       => $departure->{platform},
		platform_name  => $departure->{platformName},
		platform_type  => $departure->{pointType},
		key            => $departure->{servingLine}{key},
		stateless      => $departure->{servingLine}{stateless},
		stop_id        => $departure->{stopID},
		line           => $departure->{servingLine}{symbol},
		train_type     => $departure->{servingLine}{trainType},
		train_name     => $departure->{servingLine}{trainName},
+9 −7
Original line number Diff line number Diff line
@@ -9,9 +9,9 @@ use parent 'Class::Accessor';
our $VERSION = '2.02';

Travel::Status::DE::EFA::Departure->mk_ro_accessors(
	qw(countdown datetime delay destination is_cancelled key line lineref
	  mot occupancy operator origin platform platform_db platform_name
	  rt_datetime sched_datetime train_type train_name train_no type)
	qw(countdown datetime delay destination is_cancelled key line lineref mot
	  occupancy operator origin platform platform_db platform_name rt_datetime
	  sched_datetime stateless stop_id train_type train_name train_no type)
);

my @mot_mapping = qw{
@@ -189,10 +189,8 @@ may be recent news related to the line's schedule.

=item $departure->key

Unknown.  Unlike the name may suggest, this is not a unique key / UUID for a
departure: On the same day, different lines departing at the same station
may have the same key.  It might, however, be unique when combined with the
B<line> information.
Key of this departure of the corresponding line. Unique for a given day when
combined with B<stateless>.

=item $departure->line

@@ -262,6 +260,10 @@ realtime data. Undef if unknown / unavailable.

DateTime(3pm) object holding the scheduled departure date and time.

=item $departure->stateless

Unique line identifier.

=item $departure->train_type

Train type, e.g. "ICE". Typically only defined for long-distance trains.