From b36db90dcc8047e5877306caabcdc0a58f4fc9db Mon Sep 17 00:00:00 2001 From: Akamaru Date: Wed, 26 Nov 2025 21:16:33 +0100 Subject: [PATCH] =?UTF-8?q?ADN:=20F=C3=BCge=20Franz=C3=B6sisch=20hinzu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AnimationDigitalNetworkBridge.php | 44 ++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 13 deletions(-) diff --git a/AnimationDigitalNetworkBridge.php b/AnimationDigitalNetworkBridge.php index 1d810c7..d523368 100644 --- a/AnimationDigitalNetworkBridge.php +++ b/AnimationDigitalNetworkBridge.php @@ -1,11 +1,13 @@ Récupère les derniers épisodes d\'une série d\'Animation Digital Network'; public function getIcon() { @@ -20,12 +22,23 @@ class AnimationDigitalNetworkBridge extends BridgeAbstract { 'required' => true, 'exampleValue' => '1333', 'title' => 'Die ID der Serie (z.B. 1333 aus der URL /video/1333-serienname/)' + ), + 'region' => array( + 'name' => 'Region/Sprache', + 'type' => 'list', + 'required' => false, + 'defaultValue' => 'de', + 'values' => array( + 'Deutsch' => 'de', + 'Français' => 'fr' + ) ) ) ); public function collectData() { $show_id = $this->getInput('show_id'); + $region = $this->getInput('region') ?? 'de'; if (empty($show_id)) { returnClientError('Show-ID ist erforderlich'); @@ -34,10 +47,10 @@ class AnimationDigitalNetworkBridge extends BridgeAbstract { // API-Aufruf zur Seasons-API $seasonsUrl = 'https://gw.api.animationdigitalnetwork.com/video/show/' . $show_id . '/seasons?order=asc'; - // Headers für API-Requests + // Headers für API-Requests (dynamisch basierend auf Region) $headers = [ - 'Accept-Language: de', - 'x-target-distribution: de' + 'Accept-Language: ' . $region, + 'x-target-distribution: ' . $region ]; $seasonsJson = getContents($seasonsUrl, $headers); @@ -87,7 +100,7 @@ class AnimationDigitalNetworkBridge extends BridgeAbstract { // Titel $item['title'] = $video['title']; - // URI + // URI (die API liefert bereits den korrekten Pfad mit/ohne /de) $item['uri'] = 'https://animationdigitalnetwork.com' . $video['urlPath']; // UID @@ -104,7 +117,9 @@ class AnimationDigitalNetworkBridge extends BridgeAbstract { $categories[] = $video['seasonTitle']; } if (!empty($video['seasonNumber'])) { - $categories[] = 'Staffel ' . $video['seasonNumber']; + // Lokalisierung: "Staffel" für de, "Saison" für fr + $seasonLabel = ($region === 'fr') ? 'Saison' : 'Staffel'; + $categories[] = $seasonLabel . ' ' . $video['seasonNumber']; } if (!empty($categories)) { $item['categories'] = $categories; @@ -115,11 +130,14 @@ class AnimationDigitalNetworkBridge extends BridgeAbstract { $item['enclosures'] = array($video['image']); } - // Autor - if (isset($episodeDetails['show']['title'])) { - $item['author'] = $episodeDetails['show']['title']; + // Show-Titel für getName() speichern + if (isset($episodeDetails['show']['title']) && $this->showTitle === null) { + $this->showTitle = $episodeDetails['show']['title']; } + // Autor + $item['author'] = 'ADN'; + // Content: Bild + Beschreibung $content = ''; @@ -141,11 +159,11 @@ class AnimationDigitalNetworkBridge extends BridgeAbstract { public function getName() { if ($this->getInput('show_id')) { - // Wenn wir Items haben, können wir den Show-Titel verwenden - if (!empty($this->items) && !empty($this->items[0]['author'])) { - return $this->items[0]['author'] . ' - Animation Digital Network'; + // Wenn wir den Show-Titel haben, verwenden wir ihn + if ($this->showTitle !== null) { + return $this->showTitle . ' - ADN'; } - return 'Show ' . $this->getInput('show_id') . ' - Animation Digital Network'; + return 'Show ' . $this->getInput('show_id') . ' - ADN'; } return parent::getName(); }