예제 #1
0
        public Form1()
        {
            InitializeComponent();

            _opml = new Opml();
            _opml.ReadSubscriptions(@"C:\Users\jls\Google Drive\all-subscriptions.opml");

            _titleAndUrls = TitleAndUrlRepository.BuildTitleAndUrls(_opml);

            LoadControls();
        }
예제 #2
0
        public Form1()
        {
            InitializeComponent();

            _opml = new Opml();
            _opml.ReadSubscriptions(@"C:\Users\jls\Google Drive\all-subscriptions.opml");

            _titleAndUrls = TitleAndUrlRepository.BuildTitleAndUrls(_opml);

            LoadControls();
        }
예제 #3
0
파일: Opml.cs 프로젝트: johno4321/Podcaster
        public static IEnumerable <TitleAndUrl> BuildTitleAndUrls(Opml opml)
        {
            var titleAndUrls = new List <TitleAndUrl>();

            foreach (var opmlOutline in opml.Outlines)
            {
                var titleAndUrl = new TitleAndUrl();
                titleAndUrls.Add(titleAndUrl);

                titleAndUrl.Podcasts = new List <Podcast>();

                if (opmlOutline.Attributes.ContainsKey(TitleAttribute))
                {
                    titleAndUrl.Title = opmlOutline.Attributes[TitleAttribute];
                }

                if (!opmlOutline.Attributes.ContainsKey(XmlUrlAttribute))
                {
                    continue;
                }

                titleAndUrl.Url = new Uri(opmlOutline.Attributes[XmlUrlAttribute]);

                if (titleAndUrl.Title != null)
                {
                    continue;
                }

                var settings = new SyndicationResourceLoadSettings();
                var feed     = RssFeed.Create(titleAndUrl.Url, settings);

                foreach (var item in feed.Channel.Items)
                {
                    var podcast = new Podcast();
                    podcast.Title = item.Title;
                    podcast.Url   = item.Link;
                    titleAndUrl.Podcasts.Add(podcast);
                }
            }

            return(titleAndUrls);
        }
예제 #4
0
파일: Opml.cs 프로젝트: johno4321/Podcaster
        public static IEnumerable<TitleAndUrl> BuildTitleAndUrls(Opml opml)
        {
            var titleAndUrls = new List<TitleAndUrl>();

            foreach (var opmlOutline in opml.Outlines)
            {
                var titleAndUrl = new TitleAndUrl();
                titleAndUrls.Add(titleAndUrl);

                titleAndUrl.Podcasts = new List<Podcast>();

                if (opmlOutline.Attributes.ContainsKey(TitleAttribute))
                {
                    titleAndUrl.Title = opmlOutline.Attributes[TitleAttribute];
                }

                if (!opmlOutline.Attributes.ContainsKey(XmlUrlAttribute)) continue;

                titleAndUrl.Url = new Uri(opmlOutline.Attributes[XmlUrlAttribute]);

                if (titleAndUrl.Title != null) continue;

                var settings = new SyndicationResourceLoadSettings();
                var feed = RssFeed.Create(titleAndUrl.Url, settings);

                foreach (var item in feed.Channel.Items)
                {
                    var podcast = new Podcast();
                    podcast.Title = item.Title;
                    podcast.Url = item.Link;
                    titleAndUrl.Podcasts.Add(podcast);
                }
            }

            return titleAndUrls;
        }