summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2025-02-01 20:14:46 +0100
committerBirte Kristina Friesel <derf@finalrewind.org>2025-02-01 20:14:46 +0100
commitf1ca0ba41421f4e602312b4a3ea6ee8ad13366f1 (patch)
tree367e5fa7952e711866720bad8f814a15683725d7
parentdb9c1bf21b197166ecc7f55ffa63a8f9612254cb (diff)
Switch from DBWagenreihung to DBRIS::Formation
-rw-r--r--cpanfile6
-rw-r--r--lib/DBInfoscreen/Controller/Stationboard.pm6
-rw-r--r--lib/DBInfoscreen/Controller/Wagenreihung.pm9
-rw-r--r--templates/about.html.ep4
-rw-r--r--templates/wagenreihung.html.ep4
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 @@
<strong>v<%= $Travel::Status::DE::HAFAS::VERSION %></strong></li>
<li>Nah- und Regionalverkehr im In- und Ausland: EFA via <a href="https://finalrewind.org/projects/Travel-Status-DE-VRR/">Travel::Status::DE::EFA</a>
<strong>v<%= $Travel::Status::DE::EFA::VERSION %></strong></li>
- <li>Wagenreihung im Netz der DB InfraGO: <a href="https://finalrewind.org/projects/Travel-Status-DE-DBWagenreihung/">Travel::Status::DE::DBWagenreihung</a>
- <strong>v<%= $Travel::Status::DE::DBWagenreihung::VERSION %></strong></li>
+ <li>Wagenreihung im Netz der DB InfraGO: <a href="https://finalrewind.org/projects/Travel-Status-DE-DBRIS/">Travel::Status::DE::DBRIS::Formation</a>
+ <strong>v<%= $Travel::Status::DE::DBRIS::Formation::VERSION %></strong></li>
</ul>
</p>
<p>
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) {
<div class="container">
<div class="error">
<strong>Fehler bei der Abfrage der Wagenreihung:</strong>
- <%= $wr ? $wr->errstr : $wr_error %>
+ <%= $wr_error // 'Unbekannter Fehler' %>
</div>
</div>
% }