mirror of
https://github.com/koel/koel
synced 2024-11-10 06:34:14 +00:00
fix: syncing podcasts
This commit is contained in:
parent
4dbffdb734
commit
92b90f7859
1 changed files with 11 additions and 11 deletions
|
@ -91,6 +91,17 @@ class PodcastService
|
|||
$parser = $this->createParser($podcast->url);
|
||||
$channel = $parser->getChannel();
|
||||
|
||||
$pubDate = $parser->xmlReader->value('rss.channel.pubDate')->first()
|
||||
?? $parser->xmlReader->value('rss.channel.lastBuildDate')->first();
|
||||
|
||||
if ($pubDate && Carbon::createFromFormat(Carbon::RFC1123, $pubDate)->isBefore($podcast->last_synced_at)) {
|
||||
// The pubDate/lastBuildDate value indicates that there's no new content since last check.
|
||||
// We'll simply return the podcast.
|
||||
return $podcast;
|
||||
}
|
||||
|
||||
$this->synchronizeEpisodes($podcast, $parser->getEpisodes(true));
|
||||
|
||||
$podcast->update([
|
||||
'title' => $channel->title,
|
||||
'description' => $channel->description,
|
||||
|
@ -104,17 +115,6 @@ class PodcastService
|
|||
'last_synced_at' => now(),
|
||||
]);
|
||||
|
||||
$pubDate = $parser->xmlReader->value('rss.channel.pubDate')->first()
|
||||
?? $parser->xmlReader->value('rss.channel.lastBuildDate')->first();
|
||||
|
||||
if ($pubDate && Carbon::createFromFormat(Carbon::RFC1123, $pubDate)->isBefore($podcast->last_synced_at)) {
|
||||
// The pubDate/lastBuildDate value indicates that there's no new content since last check.
|
||||
// We'll simply return the podcast.
|
||||
return $podcast;
|
||||
}
|
||||
|
||||
$this->synchronizeEpisodes($podcast, $parser->getEpisodes(true));
|
||||
|
||||
return $podcast->refresh();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue