Bugfixes and more work on station podcast frontend

This commit is contained in:
Duncan Sommerville 2015-10-22 18:03:38 -04:00
parent 58a7b9324b
commit e8980e7a79
9 changed files with 82 additions and 56 deletions

View file

@ -50,12 +50,13 @@ class PodcastManager {
$podcastArray = Application_Service_PodcastService::getPodcastById($podcast->getDbPodcastId());
$episodeList = $podcastArray["episodes"];
$episodes = array();
// Sort the episodes by publication date to get the most recent
usort($episodeList, array(static::class, "_sortByEpisodePubDate"));
for ($i = 0; $i < sizeof($episodeList); $i++) {
$episodeData = $episodeList[$i];
$ingestTimestamp = $podcast->getDbAutoIngestTimestamp();
// If the publication date of this episode is before the ingest timestamp, we don't need to ingest it
// Since we're sorting by publication date, we can break
if ($episodeData["pub_date"] < $ingestTimestamp) continue;
if (strtotime($episodeData["pub_date"]) < strtotime($podcast->getDbAutoIngestTimestamp())) break;
$episode = PodcastEpisodesQuery::create()->findOneByDbEpisodeGuid($episodeData["guid"]);
// Make sure there's no existing episode placeholder or import, and that the data is non-empty
if (empty($episode) && !empty($episodeData)) {