From f1ca0ba41421f4e602312b4a3ea6ee8ad13366f1 Mon Sep 17 00:00:00 2001
From: Birte Kristina Friesel
Date: Sat, 1 Feb 2025 20:14:46 +0100
Subject: Switch from DBWagenreihung to DBRIS::Formation
---
cpanfile | 6 +++---
lib/DBInfoscreen/Controller/Stationboard.pm | 6 +++---
lib/DBInfoscreen/Controller/Wagenreihung.pm | 9 ++++-----
templates/about.html.ep | 4 ++--
templates/wagenreihung.html.ep | 4 ++--
5 files changed, 14 insertions(+), 15 deletions(-)
diff --git a/cpanfile b/cpanfile
index af68a3c..0d4b33a 100644
--- a/cpanfile
+++ b/cpanfile
@@ -10,8 +10,8 @@ requires 'List::UtilsBy';
requires 'LWP::UserAgent';
requires 'LWP::Protocol::https';
requires 'Mojolicious';
-requires 'Travel::Status::DE::DBWagenreihung', '== 0.18';
-requires 'Travel::Status::DE::EFA', '>= 3.06';
-requires 'Travel::Status::DE::HAFAS', '>= 5.06';
+requires 'Travel::Status::DE::DBRIS::Formation', '>= 0.04';
+requires 'Travel::Status::DE::EFA', '>= 3.06';
+requires 'Travel::Status::DE::HAFAS', '>= 5.06';
requires 'Travel::Status::DE::IRIS';
requires 'XML::LibXML';
diff --git a/lib/DBInfoscreen/Controller/Stationboard.pm b/lib/DBInfoscreen/Controller/Stationboard.pm
index c5d27ab..1bdb00c 100644
--- a/lib/DBInfoscreen/Controller/Stationboard.pm
+++ b/lib/DBInfoscreen/Controller/Stationboard.pm
@@ -16,7 +16,7 @@ use List::MoreUtils qw();
use Mojo::JSON qw(decode_json encode_json);
use Mojo::Promise;
use Mojo::UserAgent;
-use Travel::Status::DE::DBWagenreihung;
+use Travel::Status::DE::DBRIS::Formation;
use Travel::Status::DE::EFA;
use Travel::Status::DE::HAFAS;
use Travel::Status::DE::IRIS;
@@ -793,8 +793,8 @@ sub render_train {
my ( $wr_json, $wr_param ) = @_;
eval {
my $wr
- = Travel::Status::DE::DBWagenreihung->new(
- from_json => $wr_json );
+ = Travel::Status::DE::DBRIS::Formation->new(
+ json => $wr_json );
$departure->{wr} = $wr;
$departure->{wr_link} = join( '&',
map { $_ . '=' . $wr_param->{$_} } keys %{$wr_param} );
diff --git a/lib/DBInfoscreen/Controller/Wagenreihung.pm b/lib/DBInfoscreen/Controller/Wagenreihung.pm
index a4a0ddc..b9f0ee3 100644
--- a/lib/DBInfoscreen/Controller/Wagenreihung.pm
+++ b/lib/DBInfoscreen/Controller/Wagenreihung.pm
@@ -10,7 +10,7 @@ use Mojo::Util qw(b64_encode b64_decode);
use utf8;
-use Travel::Status::DE::DBWagenreihung;
+use Travel::Status::DE::DBRIS::Formation;
sub handle_wagenreihung_error {
my ( $self, $train, $err ) = @_;
@@ -43,8 +43,7 @@ sub wagenreihung {
my $wr;
eval {
$wr
- = Travel::Status::DE::DBWagenreihung->new(
- from_json => $json );
+ = Travel::Status::DE::DBRIS::Formation->new( json => $json );
};
if ($@) {
$self->handle_wagenreihung_error( $train, scalar $@ );
@@ -176,7 +175,7 @@ sub wagenreihung {
ts => $json->{ts},
);
}
- )->catch(
+ )->catch(
sub {
my ($err) = @_;
@@ -184,7 +183,7 @@ sub wagenreihung {
$err // "Unbekannter Fehler" );
return;
}
- )->wait;
+ )->wait;
}
diff --git a/templates/about.html.ep b/templates/about.html.ep
index b34aa55..90a1a66 100644
--- a/templates/about.html.ep
+++ b/templates/about.html.ep
@@ -22,8 +22,8 @@
v<%= $Travel::Status::DE::HAFAS::VERSION %>
Nah- und Regionalverkehr im In- und Ausland: EFA via Travel::Status::DE::EFA
v<%= $Travel::Status::DE::EFA::VERSION %>
- Wagenreihung im Netz der DB InfraGO: Travel::Status::DE::DBWagenreihung
- v<%= $Travel::Status::DE::DBWagenreihung::VERSION %>
+ Wagenreihung im Netz der DB InfraGO: Travel::Status::DE::DBRIS::Formation
+ v<%= $Travel::Status::DE::DBRIS::Formation::VERSION %>
diff --git a/templates/wagenreihung.html.ep b/templates/wagenreihung.html.ep
index 3da4257..19c49ab 100644
--- a/templates/wagenreihung.html.ep
+++ b/templates/wagenreihung.html.ep
@@ -1,8 +1,8 @@
-% if (not $wr or $wr->errstr) {
+% if (not $wr or $wr_error) {
Fehler bei der Abfrage der Wagenreihung:
- <%= $wr ? $wr->errstr : $wr_error %>
+ <%= $wr_error // 'Unbekannter Fehler' %>
% }
--
cgit v1.2.3