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
class AnimationDigitalNetworkBridge extends BridgeAbstract {
private $showTitle = null;
const MAINTAINER = 'Akamaru';
const NAME = 'Animation Digital Network';
const URI = 'https://animationdigitalnetwork.com/';
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()
{
@@ -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();
}