mirror of
https://code.castopod.org/adaures/castopod
synced 2025-06-06 01:12:01 +00:00
fix(import): use <image><url> tag when no <itunes:image> is present
This commit is contained in:
parent
dbba8dc581
commit
20e607afb7
@ -107,41 +107,61 @@ class PodcastImport extends BaseController
|
|||||||
|
|
||||||
$channelDescriptionHtml = $feed->channel[0]->description;
|
$channelDescriptionHtml = $feed->channel[0]->description;
|
||||||
|
|
||||||
$podcast = new \App\Entities\Podcast([
|
try {
|
||||||
'name' => $this->request->getPost('name'),
|
$podcast = new \App\Entities\Podcast([
|
||||||
'imported_feed_url' => $this->request->getPost('imported_feed_url'),
|
'name' => $this->request->getPost('name'),
|
||||||
'new_feed_url' => base_url(
|
'imported_feed_url' => $this->request->getPost(
|
||||||
route_to('podcast_feed', $this->request->getPost('name'))
|
'imported_feed_url'
|
||||||
),
|
),
|
||||||
'title' => $feed->channel[0]->title,
|
'new_feed_url' => base_url(
|
||||||
'description_markdown' => $converter->convert(
|
route_to('podcast_feed', $this->request->getPost('name'))
|
||||||
$channelDescriptionHtml
|
),
|
||||||
),
|
'title' => $feed->channel[0]->title,
|
||||||
'description_html' => $channelDescriptionHtml,
|
'description_markdown' => $converter->convert(
|
||||||
'image' => download_file($nsItunes->image->attributes()),
|
$channelDescriptionHtml
|
||||||
'language_code' => $this->request->getPost('language'),
|
),
|
||||||
'category_id' => $this->request->getPost('category'),
|
'description_html' => $channelDescriptionHtml,
|
||||||
'parental_advisory' => empty($nsItunes->explicit)
|
'image' => $nsItunes->image && !empty($nsItunes->image->attributes())
|
||||||
? null
|
? download_file($nsItunes->image->attributes())
|
||||||
: (in_array($nsItunes->explicit, ['yes', 'true'])
|
: ($feed->channel[0]->image && !empty($feed->channel[0]->image->url)
|
||||||
? 'explicit'
|
? download_file($feed->channel[0]->image->url)
|
||||||
: (in_array($nsItunes->explicit, ['no', 'false'])
|
: null),
|
||||||
? 'clean'
|
'language_code' => $this->request->getPost('language'),
|
||||||
: null)),
|
'category_id' => $this->request->getPost('category'),
|
||||||
'owner_name' => $nsItunes->owner->name,
|
'parental_advisory' => empty($nsItunes->explicit)
|
||||||
'owner_email' => $nsItunes->owner->email,
|
? null
|
||||||
'publisher' => $nsItunes->author,
|
: (in_array($nsItunes->explicit, ['yes', 'true'])
|
||||||
'type' => empty($nsItunes->type) ? 'episodic' : $nsItunes->type,
|
? 'explicit'
|
||||||
'copyright' => $feed->channel[0]->copyright,
|
: (in_array($nsItunes->explicit, ['no', 'false'])
|
||||||
'is_blocked' => empty($nsItunes->block)
|
? 'clean'
|
||||||
? false
|
: null)),
|
||||||
: $nsItunes->block === 'yes',
|
'owner_name' => $nsItunes->owner->name,
|
||||||
'is_completed' => empty($nsItunes->complete)
|
'owner_email' => $nsItunes->owner->email,
|
||||||
? false
|
'publisher' => $nsItunes->author,
|
||||||
: $nsItunes->complete === 'yes',
|
'type' => empty($nsItunes->type) ? 'episodic' : $nsItunes->type,
|
||||||
'created_by' => user(),
|
'copyright' => $feed->channel[0]->copyright,
|
||||||
'updated_by' => user(),
|
'is_blocked' => empty($nsItunes->block)
|
||||||
]);
|
? false
|
||||||
|
: $nsItunes->block === 'yes',
|
||||||
|
'is_completed' => empty($nsItunes->complete)
|
||||||
|
? false
|
||||||
|
: $nsItunes->complete === 'yes',
|
||||||
|
'created_by' => user(),
|
||||||
|
'updated_by' => user(),
|
||||||
|
]);
|
||||||
|
} catch (\ErrorException $ex) {
|
||||||
|
return redirect()
|
||||||
|
->back()
|
||||||
|
->withInput()
|
||||||
|
->with('errors', [
|
||||||
|
$ex->getMessage() .
|
||||||
|
': <a href="' .
|
||||||
|
$this->request->getPost('imported_feed_url') .
|
||||||
|
'" rel="noreferrer noopener" target="_blank">' .
|
||||||
|
$this->request->getPost('imported_feed_url') .
|
||||||
|
' ⎋</a>',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
$podcastModel = new PodcastModel();
|
$podcastModel = new PodcastModel();
|
||||||
$db = \Config\Database::connect();
|
$db = \Config\Database::connect();
|
||||||
@ -200,10 +220,12 @@ class PodcastImport extends BaseController
|
|||||||
'is_visible' => false,
|
'is_visible' => false,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
$platformModel->createPodcastPlatforms(
|
if (count($podcastsPlatformsData) > 1) {
|
||||||
$newPodcastId,
|
$platformModel->createPodcastPlatforms(
|
||||||
$podcastsPlatformsData
|
$newPodcastId,
|
||||||
);
|
$podcastsPlatformsData
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
$numberItems = $feed->channel[0]->item->count();
|
$numberItems = $feed->channel[0]->item->count();
|
||||||
$lastItem =
|
$lastItem =
|
||||||
|
Loading…
x
Reference in New Issue
Block a user