1
0

ADN: Füge Französisch hinzu

This commit is contained in:
Akamaru
2025-11-26 21:16:33 +01:00
parent 04eb703d03
commit b36db90dcc

View File

@@ -1,11 +1,13 @@
<?php <?php
class AnimationDigitalNetworkBridge extends BridgeAbstract { class AnimationDigitalNetworkBridge extends BridgeAbstract {
private $showTitle = null;
const MAINTAINER = 'Akamaru'; const MAINTAINER = 'Akamaru';
const NAME = 'Animation Digital Network'; const NAME = 'Animation Digital Network';
const URI = 'https://animationdigitalnetwork.com/'; const URI = 'https://animationdigitalnetwork.com/';
const CACHE_TIMEOUT = 3600; // 1h const CACHE_TIMEOUT = 3600; // 1h
const DESCRIPTION = 'Holt die neuesten Episoden einer Serie von Animation Digital Network'; const DESCRIPTION = 'Holt die neuesten Episoden einer Serie von Animation Digital Network<br>Récupère les derniers épisodes d\'une série d\'Animation Digital Network';
public function getIcon() public function getIcon()
{ {
@@ -20,12 +22,23 @@ class AnimationDigitalNetworkBridge extends BridgeAbstract {
'required' => true, 'required' => true,
'exampleValue' => '1333', 'exampleValue' => '1333',
'title' => 'Die ID der Serie (z.B. 1333 aus der URL /video/1333-serienname/)' '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() { public function collectData() {
$show_id = $this->getInput('show_id'); $show_id = $this->getInput('show_id');
$region = $this->getInput('region') ?? 'de';
if (empty($show_id)) { if (empty($show_id)) {
returnClientError('Show-ID ist erforderlich'); returnClientError('Show-ID ist erforderlich');
@@ -34,10 +47,10 @@ class AnimationDigitalNetworkBridge extends BridgeAbstract {
// API-Aufruf zur Seasons-API // API-Aufruf zur Seasons-API
$seasonsUrl = 'https://gw.api.animationdigitalnetwork.com/video/show/' . $show_id . '/seasons?order=asc'; $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 = [ $headers = [
'Accept-Language: de', 'Accept-Language: ' . $region,
'x-target-distribution: de' 'x-target-distribution: ' . $region
]; ];
$seasonsJson = getContents($seasonsUrl, $headers); $seasonsJson = getContents($seasonsUrl, $headers);
@@ -87,7 +100,7 @@ class AnimationDigitalNetworkBridge extends BridgeAbstract {
// Titel // Titel
$item['title'] = $video['title']; $item['title'] = $video['title'];
// URI // URI (die API liefert bereits den korrekten Pfad mit/ohne /de)
$item['uri'] = 'https://animationdigitalnetwork.com' . $video['urlPath']; $item['uri'] = 'https://animationdigitalnetwork.com' . $video['urlPath'];
// UID // UID
@@ -104,7 +117,9 @@ class AnimationDigitalNetworkBridge extends BridgeAbstract {
$categories[] = $video['seasonTitle']; $categories[] = $video['seasonTitle'];
} }
if (!empty($video['seasonNumber'])) { 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)) { if (!empty($categories)) {
$item['categories'] = $categories; $item['categories'] = $categories;
@@ -115,11 +130,14 @@ class AnimationDigitalNetworkBridge extends BridgeAbstract {
$item['enclosures'] = array($video['image']); $item['enclosures'] = array($video['image']);
} }
// Autor // Show-Titel für getName() speichern
if (isset($episodeDetails['show']['title'])) { if (isset($episodeDetails['show']['title']) && $this->showTitle === null) {
$item['author'] = $episodeDetails['show']['title']; $this->showTitle = $episodeDetails['show']['title'];
} }
// Autor
$item['author'] = 'ADN';
// Content: Bild + Beschreibung // Content: Bild + Beschreibung
$content = ''; $content = '';
@@ -141,11 +159,11 @@ class AnimationDigitalNetworkBridge extends BridgeAbstract {
public function getName() { public function getName() {
if ($this->getInput('show_id')) { if ($this->getInput('show_id')) {
// Wenn wir Items haben, können wir den Show-Titel verwenden // Wenn wir den Show-Titel haben, verwenden wir ihn
if (!empty($this->items) && !empty($this->items[0]['author'])) { if ($this->showTitle !== null) {
return $this->items[0]['author'] . ' - Animation Digital Network'; return $this->showTitle . ' - ADN';
} }
return 'Show ' . $this->getInput('show_id') . ' - Animation Digital Network'; return 'Show ' . $this->getInput('show_id') . ' - ADN';
} }
return parent::getName(); return parent::getName();
} }