예제 #1
0
        private void ParseEpisodeMetaExtra(XElement e, EpisodeRaw episode)
        {
            switch (e.Name.ToString().ToLower())
            {
                case "{" + FeedNamespaceCollection.wfw + "}commentrss":
                    episode.WFWCommentFeed = e.Value;
                    break;

                case "{" + FeedNamespaceCollection.slash + "}comments":
                    episode.SlashComments = e.Value;
                    break;

                case "{" + FeedNamespaceCollection.dc + "}creator":
                    episode.DCCreator = e.Value;
                    break;

                case "{" + FeedNamespaceCollection.atom + "}contributor":
                    if (e.HasElements)
                    {
                        Contributor c = new Contributor();
                        foreach (var ee in e.Elements())
                        {
                            if (ee.Name.ToString().ToLower() == "{" + FeedNamespaceCollection.atom + "}name" && !ee.IsEmpty)
                            {
                                c.Name = ee.Value;
                            }
                            if (ee.Name.ToString().ToLower() == "{" + FeedNamespaceCollection.atom + "}uri" && !ee.IsEmpty)
                            {
                                c.URI = ee.Value;
                            }
                        }
                        if (c.Name != null && c.Name != "")
                        {
                            if (episode.Contributors == null)
                            {
                                episode.Contributors = new List<Contributor>();
                            }
                            episode.Contributors.Add(c);
                        }
                    }
                    break;
            }
        }
예제 #2
0
        private void ParsePodcastMetaAtom(XElement e, PodcastRaw podcastRaw)
        {
            if (e.Name.ToString().ToLower() == "{" + FeedNamespaceCollection.atom + "}link" && e.HasAttributes && e.Attribute("rel") != null)
            {
                switch (e.Attribute("rel").Value)
                {
                    case "alternate":
                        if (podcastRaw.LinkAlternateFeeds == null)
                        {
                            podcastRaw.LinkAlternateFeeds = new List<AlternateFeed>();
                        }
                        podcastRaw.LinkAlternateFeeds.Add(new AlternateFeed() { Title = e.Attribute("title").Value, URL = e.Attribute("href").Value });
                        break;

                    case "next":
                        podcastRaw.LinkFeedNextPageURL = e.Attribute("href").Value;
                        break;

                    case "first":
                        podcastRaw.LinkFeedFirstPageURL = e.Attribute("href").Value;
                        break;

                    case "last":
                        podcastRaw.LinkFeedLastPageURL = e.Attribute("href").Value;
                        break;

                    case "payment":
                        if (e.HasAttributes && e.Attribute("href") != null && e.Attribute("title") != null)
                        {
                            if (podcastRaw.LinkPayments == null)
                            {
                                podcastRaw.LinkPayments = new List<Payment>();
                            }
                            podcastRaw.LinkPayments.Add(new Payment() { URL = e.Attribute("href").Value, Title = e.Attribute("title").Value });
                        }
                        break;
                }
            }
            if (e.Name.ToString().ToLower() == "{" + FeedNamespaceCollection.atom + "}contributor" && e.HasElements)
            {
                Contributor c = new Contributor();
                foreach (var i in e.Elements())
                {
                    if (i.Name.ToString().ToLower() == "{" + FeedNamespaceCollection.atom + "}name")
                    {
                        c.Name = i.Value;
                    }
                    if (i.Name.ToString().ToLower() == "{" + FeedNamespaceCollection.atom + "}uri")
                    {
                        c.URI = i.Value;
                    }
                }
                if (c.Name != null && c.Name != "")
                {
                    if (podcastRaw.Contributors == null)
                    {
                        podcastRaw.Contributors = new List<Contributor>();
                    }
                    podcastRaw.Contributors.Add(c);
                }
            }
        }