summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;