From 329a91dcf051107e5aac8e7834c7ba21e273f5d5 Mon Sep 17 00:00:00 2001 From: Akamaru Date: Fri, 31 Oct 2025 15:45:17 +0100 Subject: [PATCH] =?UTF-8?q?Neue=20Bridge=20f=C3=BCr=20Animation=20Digital?= =?UTF-8?q?=20Network?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AnimationDigitalNetworkBridge.php | 194 ++++++++++++++++++++++++++++++ README.md | 8 ++ 2 files changed, 202 insertions(+) create mode 100644 AnimationDigitalNetworkBridge.php diff --git a/AnimationDigitalNetworkBridge.php b/AnimationDigitalNetworkBridge.php new file mode 100644 index 0000000..c9110fe --- /dev/null +++ b/AnimationDigitalNetworkBridge.php @@ -0,0 +1,194 @@ + array( + 'name' => 'Show-ID', + 'type' => 'number', + 'required' => true, + 'exampleValue' => '1333', + 'title' => 'Die ID der Serie (z.B. 1333 aus der URL /video/1333-serienname/)' + ) + ) + ); + + public function getIcon(){ + return 'https://animationdigitalnetwork.com/images/favicon/apple-touch-icon.webp'; + } + + public function collectData() { + $show_id = $this->getInput('show_id'); + + if (empty($show_id)) { + returnClientError('Show-ID ist erforderlich'); + } + + // API-Aufruf zur Seasons-API + $seasonsUrl = 'https://gw.api.animationdigitalnetwork.com/video/show/' . $show_id . '/seasons?order=asc'; + + // Headers für API-Requests + $headers = [ + 'Accept-Language: de', + 'x-target-distribution: de' + ]; + + $seasonsJson = getContents($seasonsUrl, $headers); + $seasonsData = json_decode($seasonsJson, true); + + if (!isset($seasonsData['seasons']) || !is_array($seasonsData['seasons'])) { + returnServerError('Konnte Seasons-Daten nicht abrufen'); + } + + // Alle Videos aus allen Seasons sammeln + $allVideos = array(); + foreach ($seasonsData['seasons'] as $season) { + if (isset($season['videos']) && is_array($season['videos'])) { + foreach ($season['videos'] as $video) { + // Staffel-Info hinzufügen + $video['seasonTitle'] = $season['title']; + $video['seasonNumber'] = $season['season']; + $allVideos[] = $video; + } + } + } + + // Array umkehren, damit neueste Folge oben ist + $allVideos = array_reverse($allVideos); + + // Auf maximal 20 Episoden limitieren (Performance) + $allVideos = array_slice($allVideos, 0, 20); + + // Für jede Episode Details abrufen und Feed-Item erstellen + foreach ($allVideos as $video) { + $item = array(); + + $episodeId = $video['id']; + + // Episode-Details abrufen + $episodeUrl = 'https://gw.api.animationdigitalnetwork.com/video/' . $episodeId . '/public'; + $episodeJson = getContents($episodeUrl, $headers); + $episodeData = json_decode($episodeJson, true); + + if (!isset($episodeData['video'])) { + // Wenn Details nicht verfügbar sind, mit Basis-Infos fortfahren + $episodeDetails = $video; + } else { + $episodeDetails = $episodeData['video']; + } + + // Titel + $item['title'] = $video['title']; + + // URI + $item['uri'] = 'https://animationdigitalnetwork.com' . $video['urlPath']; + + // UID + $item['uid'] = 'adn-' . $episodeId; + + // Timestamp + if (isset($episodeDetails['releaseDate'])) { + $item['timestamp'] = strtotime($episodeDetails['releaseDate']); + } + + // Kategorien + $categories = array(); + if (!empty($video['seasonTitle'])) { + $categories[] = $video['seasonTitle']; + } + if (!empty($video['seasonNumber'])) { + $categories[] = 'Staffel ' . $video['seasonNumber']; + } + if (!empty($categories)) { + $item['categories'] = $categories; + } + + // Enclosures (Bild) + if (!empty($video['image'])) { + $item['enclosures'] = array($video['image']); + } + + // Autor + if (isset($episodeDetails['show']['title'])) { + $item['author'] = $episodeDetails['show']['title']; + } + + // Content aufbauen + $content = ''; + + // Bild + if (!empty($video['image'])) { + $content .= '' . htmlspecialchars($item['title']) . '

'; + } + + // Summary/Beschreibung + if (isset($episodeDetails['summary']) && !empty($episodeDetails['summary'])) { + $content .= '

Beschreibung:
' . nl2br(htmlspecialchars($episodeDetails['summary'])) . '

'; + } + + // Episode-Infos + $content .= '

'; + if (!empty($video['number'])) { + $content .= 'Episode: ' . htmlspecialchars($video['number']) . '
'; + } + if (!empty($video['name'])) { + $content .= 'Titel: ' . htmlspecialchars($video['name']) . '
'; + } + if (!empty($video['seasonTitle'])) { + $content .= 'Staffel/Abschnitt: ' . htmlspecialchars($video['seasonTitle']) . '
'; + } + if (isset($video['duration'])) { + $minutes = floor($video['duration'] / 60); + $seconds = $video['duration'] % 60; + $content .= 'Dauer: ' . $minutes . ':' . sprintf('%02d', $seconds) . ' Min.
'; + } + if (isset($episodeDetails['rating'])) { + $content .= 'Bewertung: ' . $episodeDetails['rating'] . '/5'; + if (isset($episodeDetails['ratingsCount'])) { + $content .= ' (' . $episodeDetails['ratingsCount'] . ' Bewertungen)'; + } + $content .= '
'; + } + $content .= '

'; + + // Verfügbarkeit + if (isset($video['free']) || isset($video['freeWithAds'])) { + $content .= '

Verfügbarkeit: '; + if (!empty($video['free'])) { + $content .= 'Kostenlos'; + } elseif (!empty($video['freeWithAds'])) { + $content .= 'Kostenlos mit Werbung'; + } else { + $content .= 'Premium'; + } + $content .= '

'; + } + + // Show-Info (falls verfügbar) + if (isset($episodeDetails['show']['summary']) && !empty($episodeDetails['show']['summary'])) { + $content .= '

Über die Serie:
' . nl2br(htmlspecialchars($episodeDetails['show']['summary'])) . '

'; + } + + $item['content'] = $content; + + $this->items[] = $item; + } + } + + 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'; + } + return 'Show ' . $this->getInput('show_id') . ' - Animation Digital Network'; + } + return parent::getName(); + } +} diff --git a/README.md b/README.md index c7e6502..2b62cc2 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,11 @@ Diese Sammlung enthält verschiedene Bridge-Implementierungen für RSS-Bridge, u ## Verfügbare Bridges +### Animation Digital Network Bridge (Von Akamaru) +- **Beschreibung**: Holt die neuesten Episoden einer Serie von Animation Digital Network +- **Parameter**: + - **Show-ID**: Die ID der Serie (z.B. 1333 aus der URL /video/1333-serienname/) + ### Ananta Game News Bridge (Von Akamaru) - **Beschreibung**: Zeigt die neuesten Nachrichten von Ananta Game @@ -47,6 +52,9 @@ Diese Sammlung enthält verschiedene Bridge-Implementierungen für RSS-Bridge, u ### Foodwatch Bridge (Von Akamaru) - **Beschreibung**: Zeigt die neuesten Nachrichten von Foodwatch.org +### Futurama: Hit & Run Mod Releases Bridge (Von Akamaru) +- **Beschreibung**: Zeigt die neuesten Releases für die Futurama: Hit & Run Total Conversion Mod + ### Gallery Epic Bridge (Von Brawl, Gemini) - **Beschreibung**: Zeigt die neuesten Alben eines Cosplayers auf GalleryEpic