Beispiel #1
0
        public string GetRssString(string radio, string title, string description,
                                   RadioPlusOnDemandData[] onDemandMaterialData)
        {
            var feed = new Feed(radio, description)
            {
                AlternateLink = RadioPlusConst.GetRadioPlusOnDemandUrl(radio),
                Copyright     = "vrt",
                ImageUrl      =
                    "https://lh4.ggpht.com/CdCC7h9Ft5sftidozzTWggH9mUwbdBHO_1ZZCuk_O_A_2TpDuxqxqpf9OAE91LpkBw",
                Author     = "vrt",
                WebMaster  = new FeedEmailAddress("*****@*****.**", "RadioPlus"),
                ImageTitle = title,
                Link       = RadioPlusConst.GetRadioPlusOnDemandUrl(radio),
                Language   = "nl-BE",
                Title      = title
            };
            var feedItems = new List <FeedItem>();

            foreach (var channel in onDemandMaterialData)
            {
                if (channel == null)
                {
                    continue;
                }

                foreach (var episode in channel.Items)
                {
                    var channelUrl = Url.Combine(RadioPlusConst.GetRadioPlusOnDemandUrl(radio),
                                                 channel.CollectionId.ToString());
                    var feedItem = MapToEpisode(episode, channelUrl); //do more with async
                    feedItems.Add(feedItem);
                }

                feed.Items = feedItems;
            }

            return(feed.WriteRSS());
        }
Beispiel #2
0
        public string GetRssString(string radio, string channelTitle, Guid channelId,
                                   RadioPlusOnDemandData[] onDemandMaterialData)
        {
            var ondemandUrl = RadioPlusConst.GetRadioPlusOnDemandUrl(radio);
            var channelUrl  = Url.Combine(ondemandUrl, channelId.ToString());


            var channel = onDemandMaterialData.FirstOrDefault(x => x.CollectionId == channelId);

            var feed = new Feed(channelTitle + $"({radio})", radio)
            {
                AlternateLink = channelUrl,
                Copyright     = "vrt",
                ImageUrl      = channel?.Thumb,
                Author        = "vrt",
                WebMaster     = new FeedEmailAddress("*****@*****.**", "RadioPlus"),
                ImageTitle    = channelTitle + $"({radio})",
                Link          = channelUrl,
                Language      = "nl-BE"
            };

            if (channel == null)
            {
                return(feed.WriteRSS());
            }

            var feedItems = new List <FeedItem>();

            foreach (var episode in channel.Items)
            {
                var feedItem = MapToEpisode(episode, channelUrl); //do more with async
                feedItems.Add(feedItem);
            }

            feed.Items = feedItems;

            return(feed.WriteRSS());
        }