//Tar emot en lista med SyndicationItems och skapar en EpisodeList public static EpisodeList <Episode> FromSyndicationItems(IEnumerable <SyndicationItem> syndicationItems) { var episodeList = new EpisodeList <Episode>(); foreach (SyndicationItem item in syndicationItems) { episodeList.Add(Episode.FromSyndicationItem(item)); } return(episodeList); }
//Tar emot en SyndicationFeed och returnerar en PodCast public static PodCast FromSyndicationFeed(SyndicationFeed feed, string url) { var episodes = new EpisodeList <Episode>(); var feedTitle = feed.Title.Text; //Alla RSS-flöden lagrar inte URL i länksamlingen, //vi lade till URL som parameter i metoden istället. //var feedURL = feed.Links.SingleOrDefault((p) => p.MediaType == "application/rss+xml").Uri.ToString(); var feedURL = url; var lastUpdated = feed.LastUpdatedTime; foreach (SyndicationItem item in feed.Items) { episodes.Add(Episode.FromSyndicationItem(item)); } return(new PodCast(feedURL, feedTitle, episodes, lastUpdated)); }