Fix podcast episode ingest
This commit is contained in:
parent
40d0619f10
commit
a2d725f2b9
2 changed files with 13 additions and 4 deletions
|
@ -194,15 +194,24 @@ class Application_Service_PodcastService
|
|||
* @return array
|
||||
*/
|
||||
private static function _generatePodcastArray($podcast, $rss) {
|
||||
$podcastArray = $podcast->toArray(BasePeer::TYPE_FIELDNAME);
|
||||
$ingestedEpisodes = PodcastEpisodesQuery::create()
|
||||
->findByDbPodcastId($podcast->getDbId());
|
||||
$episodeIds = array();
|
||||
foreach ($ingestedEpisodes as $e) {
|
||||
array_push($episodeIds, $e->getDbEpisodeGuid());
|
||||
}
|
||||
|
||||
$podcastArray = $podcast->toArray(BasePeer::TYPE_FIELDNAME);
|
||||
$podcastArray["episodes"] = array();
|
||||
foreach ($rss->get_items() as $item) {
|
||||
/** @var SimplePie_Item $item */
|
||||
array_push($podcastArray["episodes"], array(
|
||||
"guid" => $item->get_id(),
|
||||
"ingested" => in_array($item->get_id(), $episodeIds),
|
||||
"title" => $item->get_title(),
|
||||
"author" => $item->get_author()->get_name(),
|
||||
// From the RSS spec best practices:
|
||||
// 'An item's author element provides the e-mail address of the person who wrote the item'
|
||||
"author" => $item->get_author()->get_email(),
|
||||
"description" => $item->get_description(),
|
||||
"pub_date" => $item->get_date("Y-m-d H:i:s"),
|
||||
"link" => $item->get_link(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue