From acaf6fec0ea994e2901ebffbdd4bd3f5b46c77d6 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 25 Nov 2018 15:03:01 +0100 Subject: Initial commit --- bin/dbwagenreihung | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 bin/dbwagenreihung (limited to 'bin') diff --git a/bin/dbwagenreihung b/bin/dbwagenreihung new file mode 100644 index 0000000..0c5b2fe --- /dev/null +++ b/bin/dbwagenreihung @@ -0,0 +1,36 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use 5.020; +use utf8; + +our $VERSION = '0.00'; + +use Travel::Status::DE::IRIS; +use Travel::Status::DE::DBWagenreihung; + +my ($station, $train_number) = @ARGV; + +my $res = Travel::Status::DE::IRIS->new(station => $station, with_related => 1); + +if ($res->errstr) { + say STDERR $res->errstr; + exit 1; +} + +my @trains = grep { $_->train_no eq $train_number } $res->results; + +if (@trains != 1) { + say STDERR "Unable to find train in reported departures"; + exit 1; +} + +my $wr = Travel::Status::DE::DBWagenreihung->new( + departure => $trains[0]->sched_departure, + developer_mode => 1, + train_number => $train_number, +); + +for my $wagon ($wr->wagons) { + printf("%s %s\n", $wagon->number, $wagon->section); +} -- cgit v1.2.3