fix: 💄 take itunes image first

This commit is contained in:
Michel Roux 2024-08-05 09:38:37 +02:00
parent 1302c82fdb
commit f94b529d6d
1 changed files with 9 additions and 7 deletions

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) {