fix: 💄 take itunes image first
All checks were successful
repod / xml (push) Successful in 1m36s
repod / php (push) Successful in 1m0s
repod / nodejs (push) Successful in 1m28s
repod / release (push) Has been skipped

This commit is contained in:
Michel Roux 2024-08-05 09:38:37 +02:00
parent 1302c82fdb
commit f94b529d6d

View File

@ -55,22 +55,24 @@ class EpisodeActionReader extends CoreEpisodeActionReader
$link = $this->stringOrNull($item->link); $link = $this->stringOrNull($item->link);
// Get episode image // Get episode image
$image = $this->stringOrNull($item->image->url); if (isset($iTunesItemChildren)) {
if (!isset($image) && isset($iTunesItemChildren)) {
$imageAttributes = $iTunesItemChildren->image->attributes(); $imageAttributes = $iTunesItemChildren->image->attributes();
$image = $this->stringOrNull(isset($imageAttributes) ? (string) $imageAttributes->href : ''); $image = $this->stringOrNull(isset($imageAttributes) ? (string) $imageAttributes->href : '');
} }
if (!isset($image)) {
$image = $this->stringOrNull($channel->image->url);
}
if (!isset($image) && isset($iTunesChannelChildren)) { if (!isset($image) && isset($iTunesChannelChildren)) {
$imageAttributes = $iTunesChannelChildren->image->attributes(); $imageAttributes = $iTunesChannelChildren->image->attributes();
$image = $this->stringOrNull(isset($imageAttributes) ? (string) $imageAttributes->href : ''); $image = $this->stringOrNull(isset($imageAttributes) ? (string) $imageAttributes->href : '');
} }
if (!isset($image)) {
$image = $this->stringOrNull($item->image->url);
}
if (!isset($image)) {
$image = $this->stringOrNull($channel->image->url);
}
if (!isset($image)) { if (!isset($image)) {
preg_match('/<itunes:image\s+href="([^"]+)"/', $xmlString, $matches); preg_match('/<itunes:image\s+href="([^"]+)"/', $xmlString, $matches);
if (count($matches) > 1) { if (count($matches) > 1) {