summaryrefslogtreecommitdiff
path: root/bin/efa-m
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2024-09-22 13:19:14 +0200
committerBirte Kristina Friesel <derf@finalrewind.org>2024-09-22 13:19:14 +0200
commitc438b3c4e210a4480652f297f1bf9510cdf44244 (patch)
tree2b2445ecba473799c3ebed1f7b8b1210084f29bc /bin/efa-m
parentb8bdca3c045787ad546234fff0cf5801dbe1cd92 (diff)
Switch from XML to JSON API flavour
Diffstat (limited to 'bin/efa-m')
-rwxr-xr-xbin/efa-m41
1 files changed, 25 insertions, 16 deletions
diff --git a/bin/efa-m b/bin/efa-m
index 03fd30b..36c23ea 100755
--- a/bin/efa-m
+++ b/bin/efa-m
@@ -198,6 +198,13 @@ sub format_route {
$stop->name, $stop->platform,
);
}
+ elsif ( $stop->name ) {
+ $output .= sprintf( " %40s %s\n",
+ $stop->name, $stop->platform, );
+ }
+ else {
+ $output .= "?\n";
+ }
}
return $output;
}
@@ -217,12 +224,12 @@ sub display_result {
for my $line (@lines) {
- if ( $edata{messages} and length( $line->[5] ) ) {
- $line->[5] =~ tr{\n\x0d}{ }s;
- chomp $line->[5];
+ if ( $edata{messages} and $line->[5] and @{ $line->[5] } ) {
print "\n";
- for my $info_line ( split( qr{\n}, $line->[5] ) ) {
- say "# ${info_line}";
+ for my $hint ( @{ $line->[5] } ) {
+ $hint =~ tr{\n\x0d}{ }s;
+ chomp $hint;
+ say "# ${hint}";
}
}
@@ -244,7 +251,7 @@ sub show_lines {
for my $l ( $efa->lines ) {
- if ( ( @grep_lines and none { $l->name eq $_ } @grep_lines )
+ if ( ( @grep_lines and none { $l->number eq $_ } @grep_lines )
or ( @grep_mots and none { $l->mot_name eq $_ } @grep_mots ) )
{
next;
@@ -254,8 +261,13 @@ sub show_lines {
next;
}
- push( @output,
- [ $l->type, $l->name, $l->direction // q{}, q{}, $l->route // q{} ]
+ push(
+ @output,
+ [
+ $l->type, $l->number,
+ $l->direction // q{}, q{},
+ $l->route // q{}
+ ]
);
}
@@ -288,10 +300,6 @@ sub show_results {
: $d->datetime->strftime('%H:%M')
);
- if ( $d->platform_db ) {
- $platform .= ' (DB)';
- }
-
if (
( @grep_lines and none { $d->line eq $_ } @grep_lines )
or ( @grep_mots and none { $d->mot_name eq $_ } @grep_mots )
@@ -326,12 +334,15 @@ sub show_results {
}
my $line = $d->line;
- if ( length($line) > 10 and $d->train_type and $d->train_no ) {
+ if ( ( length($line) > 10 or not $line )
+ and $d->train_type
+ and $d->train_no )
+ {
$line = $d->train_type . ' ' . $d->train_no;
}
@output_line
- = ( $dtime, $platform, $line, q{}, $d->destination, $d->info );
+ = ( $dtime, $platform, $line, q{}, $d->destination, [ $d->hints ] );
if ( $edata{route} ) {
$output_line[3]
@@ -615,8 +626,6 @@ None.
=item * Travel::Status::DE::EFA(3pm)
-=item * XML::LibXML(3pm)
-
=back
=head1 BUGS AND LIMITATIONS