summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2019-01-02 14:50:21 +0100
committerDaniel Friesel <derf@finalrewind.org>2019-01-02 14:50:21 +0100
commit1f28e0d5194b4671c1192a09f948d973608b3628 (patch)
treec177d6976948b09db1157c7c3e57a0de632a31d4
parent64af46a2ebc0ad096946bb33c54056b686846cce (diff)
show wagon model / series
-rwxr-xr-xbin/db-wagenreihung9
-rw-r--r--lib/Travel/Status/DE/DBWagenreihung/Wagon.pm5
2 files changed, 10 insertions, 4 deletions
diff --git a/bin/db-wagenreihung b/bin/db-wagenreihung
index 7a17c27..0150ae6 100755
--- a/bin/db-wagenreihung
+++ b/bin/db-wagenreihung
@@ -70,7 +70,8 @@ my $wr = Travel::Status::DE::DBWagenreihung->new(
train_number => $train_number,
);
-printf("%s %s in %s Gleis %s\n", $wr->train_type, $wr->train_no, $wr->station_name, $wr->platform);
+printf( "%s %s in %s Gleis %s\n",
+ $wr->train_type, $wr->train_no, $wr->station_name, $wr->platform );
for my $section ( $wr->sections ) {
my $section_length = $section->length_percent;
@@ -127,7 +128,9 @@ print $wr->direction == 100 ? '>' : '<';
print "\n\n";
for my $wagon ( $wr->wagons ) {
- printf( "%3s: %10s %s\n",
+ printf(
+ "%3s: %3s %10s %s\n",
$wagon->number || '?',
- $wagon->type, join( q{ }, $wagon->attributes ) );
+ $wagon->model, $wagon->type, join( q{ }, $wagon->attributes )
+ );
}
diff --git a/lib/Travel/Status/DE/DBWagenreihung/Wagon.pm b/lib/Travel/Status/DE/DBWagenreihung/Wagon.pm
index f25e85c..5c2957e 100644
--- a/lib/Travel/Status/DE/DBWagenreihung/Wagon.pm
+++ b/lib/Travel/Status/DE/DBWagenreihung/Wagon.pm
@@ -13,7 +13,7 @@ our $VERSION = '0.00';
Travel::Status::DE::DBWagenreihung::Wagon->mk_ro_accessors(
qw(attributes class_type has_ac has_accessibility has_bistro has_compartments
has_multipurpose is_dosto is_interregio is_locomotive is_powercar number
- section type)
+ model section type)
);
sub new {
@@ -25,9 +25,12 @@ sub new {
$ref->{is_locomotive} = 0;
$ref->{is_powercar} = 0;
$ref->{number} = $opt{wagenordnungsnummer};
+ $ref->{model} = $opt{fahrzeugnummer};
$ref->{section} = $opt{fahrzeugsektor};
$ref->{type} = $opt{fahrzeugtyp};
+ $ref->{model} =~ s{^.....(...)....$}{$1};
+
my $self = bless( $ref, $obj );
$self->parse_type;