Beispiel #1
0
        public static void GetPodcastFromRss(string category, int updateFrequency, string url)
        {
            using (var reader = XmlReader.Create(url))
            {
                try
                {
                    var feed         = SyndicationFeed.Load(reader);
                    var podcastName  = feed.Title.Text;
                    int episodeCount = 0;
                    foreach (SyndicationItem s in feed.Items)
                    {
                        var episodeName = s.Title.Text;
                        var detail      = s.Summary.Text;
                        var episode     = new Episode(episodeName, podcastName, detail);
                        EpisodeList.Add(episode);
                        episodeCount++;
                    }

                    PodcastList.AddPodcast(new Podcast(podcastName, category, updateFrequency, episodeCount, url));
                    PodcastUpdate.pUpdate(podcastName, category, updateFrequency, url);
                }
                catch (Exception)
                {
                    System.Windows.Forms.MessageBox.Show("Cannot read RSS");
                }
            }
        }
Beispiel #2
0
 public static void CreatePodcasts()
 {
     if (File.Exists("podcasts.txt"))
     {
         XDocument.Load("podcasts.txt").Descendants("Podcast").Select(p => (
                                                                          podcastName: p.Element("PodcastName").Value,
                                                                          podcastCategory: p.Element("PodcastCategory").Value,
                                                                          podcastUpdateFrequency: Convert.ToInt32(p.Element("PodcastUpdateFrequency").Value),
                                                                          episodeCount: Convert.ToInt32(p.Element("EpisodeCount").Value),
                                                                          url: p.Element("Url").Value
                                                                          )).ToList().ForEach(p =>
         {
             var podcast = new Podcast(p.podcastName, p.podcastCategory, p.podcastUpdateFrequency, p.episodeCount, p.url);
             Podcast.AddPodcast(p.podcastCategory, p.podcastUpdateFrequency, p.url);
             PodcastUpdate.pUpdate(p.podcastName, p.podcastCategory, p.podcastUpdateFrequency, p.url);
         });
     }
 }