* SAAS-1182 - added sanity checks and additional logic to rss import and episode generation

* SAAS-1184 - started work on podcast UI polishing
* Fixed pull request issues
This commit is contained in:
Duncan Sommerville 2015-11-09 18:17:49 -05:00
parent 1bc0f9e54b
commit 0360b5e460
8 changed files with 59 additions and 32 deletions

View file

@ -310,7 +310,7 @@ class StationPodcastTask implements AirtimeTask {
class TaskFactory {
/**
* PHP doesn't have ENUMs so declare them as interface constants
* PHP doesn't have ENUMs so declare them as constants
* Task types - values don't really matter as long as they're unique
*/

View file

@ -222,7 +222,6 @@ class LibraryController extends Zend_Controller_Action
$message = null;
$noPermissionMsg = _("You don't have permission to delete selected items.");
Logging::info($mediaItems);
foreach ($mediaItems as $media) {
if ($media["type"] === "audioclip") {

View file

@ -288,6 +288,12 @@ class Application_Service_PodcastEpisodeService extends Application_Service_Thir
$episodesArray = array();
foreach ($rss->get_items() as $item) {
// If the enclosure is empty, this isn't a podcast episode
$enclosure = $item->get_enclosure();
$url = $enclosure instanceof SimplePie_Enclosure ? $enclosure->get_link() : $enclosure["link"];
if (empty($url)) {
continue;
}
$itemId = $item->get_id();
$ingested = in_array($itemId, $episodeIds) ? (empty($episodeFiles[$itemId]) ? -1 : 1) : 0;
$file = $ingested > 0 && !empty($episodeFiles[$itemId]) ?

View file

@ -86,8 +86,17 @@ class Application_Service_PodcastService
$podcastArray["link"] = htmlspecialchars($rss->get_link());
$podcastArray["language"] = htmlspecialchars($rss->get_language());
$podcastArray["copyright"] = htmlspecialchars($rss->get_copyright());
$podcastArray["creator"] = htmlspecialchars($rss->get_author()->get_name());
$podcastArray["category"] = htmlspecialchars($rss->get_categories());
$name = empty($rss->get_author()) ? "" : $rss->get_author()->get_name();
$podcastArray["creator"] = htmlspecialchars($name);
$categories = array();
if (is_array($rss->get_categories())) {
foreach ($rss->get_categories() as $category) {
array_push($categories, $category->get_scheme() . ":" . $category->get_term());
}
}
$podcastArray["category"] = htmlspecialchars(implode($categories));
//TODO: put in constants
$itunesChannel = "http://www.itunes.com/dtds/podcast-1.0.dtd";
@ -97,9 +106,11 @@ class Application_Service_PodcastService
$itunesCategory = $rss->get_channel_tags($itunesChannel, 'category');
$categoryArray = array();
foreach ($itunesCategory as $c => $data) {
foreach ($data["attribs"] as $attrib) {
array_push($categoryArray, $attrib["text"]);
if (is_array($itunesCategory)) {
foreach ($itunesCategory as $c => $data) {
foreach ($data["attribs"] as $attrib) {
array_push($categoryArray, $attrib["text"]);
}
}
}
$podcastArray["itunes_category"] = implode(",", $categoryArray);
@ -128,6 +139,7 @@ class Application_Service_PodcastService
$importedPodcast = new ImportedPodcast();
$importedPodcast->fromArray($podcastArray, BasePeer::TYPE_FIELDNAME);
$importedPodcast->setPodcast($podcast);
$importedPodcast->setDbAutoIngest(true);
$importedPodcast->save();
return $podcast->toArray(BasePeer::TYPE_FIELDNAME);

View file

@ -18,7 +18,7 @@
</form>
</div>
<table class="datatable podcast_episodes" cellpadding="0" cellspacing="0"></table>
<!-- <table class="datatable podcast_episodes" cellpadding="0" cellspacing="0"></table>-->
<div class="btn-toolbar clearfix">
<div class="btn-group pull-right">

View file

@ -54,22 +54,22 @@
<fieldset>
<legend><?php echo _("iTunes Fields") ?></legend>
<label><?php echo _("iTunes Author") ?></label>
<label><?php echo _("Author") ?></label>
<input name="podcast_itunes_author" ng-model="podcast.itunes_author" type="text"/>
<label><?php echo _("iTunes Keywords") ?></label>
<label><?php echo _("Keywords") ?></label>
<input name="podcast_itunes_keywords" ng-model="podcast.itunes_keywords" type="text"/>
<label><?php echo _("iTunes Summary") ?></label>
<label><?php echo _("Summary") ?></label>
<textarea name="podcast_itunes_summary" ng-model="podcast.itunes_summary"></textarea>
<label><?php echo _("iTunes Subtitle") ?></label>
<label><?php echo _("Subtitle") ?></label>
<textarea name="podcast_itunes_subtitle" ng-model="podcast.itunes_subtitle"></textarea>
<label><?php echo _("iTunes Category") ?></label>
<label><?php echo _("Category") ?></label>
<input name="podcast_itunes_category" ng-model="podcast.itunes_category" type="text"/>
<label><?php echo _("iTunes Explicit") ?></label>
<label><?php echo _("Explicit") ?></label>
<input name="podcast_itunes_explicit" ng-model="podcast.itunes_explicit" type="checkbox"/>
</fieldset>
</form>