summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2016-02-28 19:38:41 +0100
committerDaniel Friesel <derf@finalrewind.org>2016-02-28 19:38:41 +0100
commit56d095e4975b3d0b4010738ebd05597b6503f4af (patch)
tree0aa8abf2c8c9229940e1ffe59ac21e941e469ab7 /bin
parent6e5b350cb7514eb94bb79d922844e9743b94e2e5 (diff)
preparations for optional emma message support
Diffstat (limited to 'bin')
-rwxr-xr-xbin/db-iris16
1 files changed, 16 insertions, 0 deletions
diff --git a/bin/db-iris b/bin/db-iris
index b90c99b..5efd3ea 100755
--- a/bin/db-iris
+++ b/bin/db-iris
@@ -23,6 +23,7 @@ my $datetime = DateTime->now( time_zone => 'Europe/Berlin' );
my $developer_mode = 0;
my $realtime = 0;
my $with_related = 1;
+my $emma_url;
my ( $filter_via, $track_via, $status_via );
my ( @grep_class, @grep_type, @grep_platform );
my ( %edata, @edata_pre );
@@ -47,6 +48,7 @@ GetOptions(
'V|track-via=s' => \$track_via,
'x|exact|no-related' => sub { $with_related = 0 },
'devmode' => \$developer_mode,
+ 'emma=s' => \$emma_url,
'version' => \&show_version,
) or show_help(1);
@@ -93,6 +95,7 @@ for my $efield (@edata_pre) {
when ('D') { $edata{delays} = 1 }
when ('f') { $edata{fullroute} = 1 }
when ('m') { $edata{messages} = 1 }
+ when ('M') { $edata{trackinfo} = 1 }
when ('q') { $edata{qos} = 1 }
when ('r') { $edata{route} = 1 }
when ('R') { $edata{replacements} = 1 }
@@ -108,6 +111,7 @@ my $status = Travel::Status::DE::IRIS->new(
lookahead => $lookahead,
station => $station,
with_related => $with_related,
+ emma_url => $emma_url,
);
if ($track_via) {
@@ -275,6 +279,18 @@ sub display_result {
}
}
+ if ( $edata{trackinfo} ) {
+ for my $message ( $d->track_messages ) {
+
+ printf(
+ " %s → %s %s\n",
+ $message->[0]->strftime('%d.%m. %H:%M'),
+ $message->[1]->strftime('%d.%m. %H:%M'),
+ $message->[3]
+ );
+ }
+ }
+
if ( $edata{messages} ) {
for my $message ( $d->messages ) {