Switch Podcast reader to use simplepie

This commit is contained in:
drigato 2015-09-23 14:47:40 -04:00
parent c5b00e56bb
commit 727abac0b8
4 changed files with 89 additions and 57 deletions

View file

@ -57,9 +57,26 @@ class Podcast extends BasePodcast
// Kind of a pain; since the rss fields are SimpleXMLElements,
// we need to explicitly cast them to strings
$podcastArray["title"] = (string)$rss->title;
$podcastArray["creator"] = (string)$rss->author;
$podcastArray["title"] = $rss->get_title();
$podcastArray["description"] = $rss->get_description();
$podcastArray["link"] = $rss->get_link();
$podcastArray["language"] = $rss->get_language();
$podcastArray["copyright"] = $rss->get_copyright();
$podcastArray["author"] = $rss->get_author();
$podcastArray["category"] = $rss->get_categories();
/*$podcastArray["title"] = (string)$rss->title;
$podcastArray["description"] = (string)$rss->description;
$podcastArray["link"] = (string)$rss->link;
$podcastArray["language"] = (string)$rss->language;
$podcastArray["copyright"] = (string)$rss->copyright;
$podcastArray["itunes_author"] = (string)$rss->{'itunes:author'};
$podcastArray["itunes_keywords"] = (string)$rss->{'itunes:keywords'};
$podcastArray["itunes_subtitle"] = (string)$rss->{'itunes:subtitle'};
$podcastArray["itunes_summary"] = (string)$rss->{'itunes:summary'};
//TODO: fix itunes_category
$podcastArray["itunes_category"] = (string)$rss->{'itunes:category'};
$podcastArray["itunes_explicit"] = (string)$rss->{'itunes:explicit'};*/
self::validatePodcastMetadata($podcastArray);
try {

View file

@ -51,7 +51,11 @@ class Application_Service_PodcastService extends Application_Service_ThirdPartyC
public static function getPodcastFeed($podcastUrl)
{
try {
return Feed::loadRss($podcastUrl);
$feed = new SimplePie();
$feed->set_feed_url($podcastUrl);
$feed->set_cache_location($_SERVER['DOCUMENT_ROOT'] . '/rss/cache_files');
$feed->init();
return $feed;
} catch (FeedException $e) {
return false;
}
@ -61,7 +65,6 @@ class Application_Service_PodcastService extends Application_Service_ThirdPartyC
{
}
/**
* Given an array of track identifiers, download RSS feed tracks
*