/// <summary>
        /// construct a feed from the supplied data in the specified format
        /// </summary>
        /// <param name="playlistFormat">the format of the data</param>
        /// <param name="feedData">the data for the feed</param>
        /// <param name="retainCopyFileName">if present then save a copy of the feed xml before parsing - null to just load</param>
        /// <returns>a podcast feed object</returns>
        public IPodcastFeed CreatePodcastFeed(PodcastFeedFormat playlistFormat, Stream feedData, string retainCopyFileName)
        {
            switch (playlistFormat)
            {
            case PodcastFeedFormat.RSS:
                return(new PodcastFeedInRssFormat(feedData, retainCopyFileName));

            default:
                throw new EnumOutOfRangeException("playlistFormat");
            }
        }
Example #2
0
        /// <summary>
        /// convert the feedformat for serialisation
        /// </summary>
        /// <returns></returns>
        public static string WriteFeedFormat(PodcastFeedFormat format)
        {
            switch (format)
            {
            case PodcastFeedFormat.RSS:
                return("rss");

            case PodcastFeedFormat.ATOM:
                return("atom");

            default:
                throw new EnumOutOfRangeException("format");
            }
        }
Example #3
0
 /// <summary>
 /// the global default for feeds
 /// </summary>
 public void SetDefaultFeedFormat(PodcastFeedFormat format)
 {
     DefaultFeedFormat = format;
 }
        /// <summary>
        /// populate a PodcastFeed from the supplied URI
        /// </summary>
        /// <param name="feedFormat">the format of the feed</param>
        /// <param name="address">the url to get the feed from</param>
        /// <param name="retainCopyFileName">if present then save a copy of the feed xml before parsing - null to just load</param>
        /// <returns>the podcast feed</returns>
        public IPodcastFeed DownloadFeed(PodcastFeedFormat feedFormat, Uri address, string retainCopyFileName)
        {
            Stream feedData = _webClient.OpenRead(address);

            return(_feedFactory.CreatePodcastFeed(feedFormat, feedData, retainCopyFileName));
        }