Пример #1
0
        public void UpdateShow(ShowControl sc)
        {
            Console.WriteLine("Updating RSS for " + sc.Title);
            if (sc.LocalFiles)
            {
                lock (_shows)
                {
                    sc.ScanLocalFilesOnly();
                }
            }
            else
            {
                XmlReader RSSFeed = sc.UpdateRSSFile();
                if (RSSFeed == null)
                {
                    Console.WriteLine("Failed to download rss feed");
                    sc.FailedCount++;
                    return;
                }

                try
                {
                    List <EpisodeControl> episodes = RSSHelper.ReadEpisodes(RSSFeed);
                    lock (_shows)
                    {
                        sc.UpdateEpisode(episodes);
                    }
                }
                catch { }
            }
        }
Пример #2
0
        public void ShouldParse4Episodes()
        {
            XmlReader         reader   = null;
            XmlReaderSettings settings = new XmlReaderSettings
            {
                DtdProcessing = DtdProcessing.Parse
            };

            var assembly     = Assembly.GetExecutingAssembly();
            var resourceName = "eWolfPodcasterCoreUnitTests.Examples.4Episodes.xml";

            List <EpisodeControl> episodes;

            using (Stream stream = assembly.GetManifestResourceStream(resourceName))
            {
                reader   = XmlReader.Create(stream, settings);
                episodes = RSSHelper.ReadEpisodes(reader);
            }

            episodes.Should().HaveCount(4);

            EpisodeControl episode = episodes[0];

            episode.Title.Should().Be("84. Algorithms You Should Know");
            episode.PodcastURL.Should().Be("http://media.blubrry.com/codingblocks/www.podtrac.com/pts/redirect.mp3/traffic.libsyn.com/codingblocks/coding-blocks-episode-84.mp3");

            episode = episodes[1];
            episode.Title.Should().Be("83. Search Driven Apps");
            episode.PodcastURL.Should().Be("http://media.blubrry.com/codingblocks/www.podtrac.com/pts/redirect.mp3/traffic.libsyn.com/codingblocks/coding-blocks-episode-83.mp3");

            episode = episodes[2];
            episode.Title.Should().Be("82. Programmer Strengths and Weaknesses");
            episode.PodcastURL.Should().Be("http://media.blubrry.com/codingblocks/www.podtrac.com/pts/redirect.mp3/traffic.libsyn.com/codingblocks/coding-blocks-episode-82.mp3");

            episode = episodes[3];
            episode.Title.Should().Be("81. Understanding Complexity Theory");
            episode.PodcastURL.Should().Be("http://media.blubrry.com/codingblocks/www.podtrac.com/pts/redirect.mp3/traffic.libsyn.com/codingblocks/coding-blocks-episode-81.mp3");
        }
Пример #3
0
        public void ShouldParseIsaacArthurEpisodes()
        {
            XmlReader         reader   = null;
            XmlReaderSettings settings = new XmlReaderSettings
            {
                DtdProcessing = DtdProcessing.Parse
            };

            var assembly     = Assembly.GetExecutingAssembly();
            var resourceName = "eWolfPodcasterCoreUnitTests.Examples.Isaac Arthur.xml";

            List <EpisodeControl> episodes;

            using (Stream stream = assembly.GetManifestResourceStream(resourceName))
            {
                reader   = XmlReader.Create(stream, settings);
                episodes = RSSHelper.ReadEpisodes(reader);
            }

            EpisodeControl episode = episodes[0];

            episode.Title.Should().Be("Programmable & Smart Matter");
            episode.PodcastURL.Should().Be("https://feeds.soundcloud.com/stream/1241912254-isaac-arthur-148927746-programmable-smart-matter.mp3");
        }
        private void CountEpisodes(XmlReader downloadRSS)
        {
            var items = RSSHelper.ReadEpisodes(downloadRSS);

            ShowLibraryData.LastDownloadMessage = $"{items.Count} Episodes";
        }