Esempio n. 1
0
    private static List <SyndicationItem> GetPosts(string pbaseUrl, SortedDictionary <string, dynamic> pPostMetaData)
    {
        var items = new List <SyndicationItem>();

        foreach (var post in pPostMetaData)
        {
            var item    = new SyndicationItem();
            var title   = post.Value.title;
            var url     = pbaseUrl + post.Value.link.url;
            var content = "<p>" + post.Value.summary + "</p>" + FirstAppeared(url, title);

            item.Title = TextSyndicationContent.CreatePlaintextContent(title);
            item.Links.Add(SyndicationLink.CreateAlternateLink(new Uri(url)));
            item.Summary = new CDataSyndicationContent(new TextSyndicationContent(content, TextSyndicationContentKind.Html));
            //item.Summary = TextSyndicationContent.CreatePlaintextContent(post.Value.summary);
            //item.Summary = TextSyndicationContent.CreateHtmlContent("<![CDATA[" + "<p>" + post.Value.summary + "</p>" + FirstAppeared(url, title) + "]]>");
            var date = DateTime.Parse(post.Value.publish_date);
            item.PublishDate = new DateTimeOffset(date);
            item.Authors.Add(new SyndicationPerson(post.Value.author.email, post.Value.author.name, post.Value.author.url));  // the parameters are the wrong way around!

            items.Add(item);
        }

        return(items);
    }
Esempio n. 2
0
        private void createVideoSyndicationFeed()
        {
            //Create syndicated feed
            var myFeed = new SyndicationFeed();

            myFeed.Title       = TextSyndicationContent.CreatePlaintextContent(user.CompanyName);
            myFeed.Description = TextSyndicationContent.CreatePlaintextContent("Video Podcast RSS FEED");
            myFeed.Links.Add(SyndicationLink.CreateAlternateLink(new Uri("https://versolstore.blob.core.windows.net/" + user.CompanyName.ToLower() + "devstoreaccount1/videos/rss.xml")));
            myFeed.Links.Add(SyndicationLink.CreateSelfLink(new Uri("https://versolstore.blob.core.windows.net/" + user.CompanyName.ToLower() + "devstoreaccount1/videos/rss.xml")));
            myFeed.Copyright = TextSyndicationContent.CreatePlaintextContent("All rights reserved");
            myFeed.Language  = "en-us";

            //Return the feed's xml content as the response
            MemoryStream       ms           = new MemoryStream();
            XmlWriter          feedWriter   = XmlWriter.Create(ms);
            Rss20FeedFormatter rssFormatter = new Rss20FeedFormatter(myFeed);

            rssFormatter.WriteTo(feedWriter);
            feedWriter.Close();
            var container = client.GetContainerReference(user.CompanyName.ToLower());
            var blob      = container.GetBlockBlobReference("videos/video.rss");

            blob.UploadFromByteArray(ms.ToArray(), 0, ms.ToArray().Length);
            ms.Close();
        }
Esempio n. 3
0
    private List <SyndicationItem> CreateFeedItems()
    {
        string departmentFis = Request.QueryString["DepartmentFIS"];
        string schoolCode    = Request.QueryString["SchoolCode"];

        var positions = PositionBLL.GetByStatusAndDepartment(false, true, true, departmentFis, schoolCode).Take(MaxItemsInFeed);

        List <SyndicationItem> feedItems = new List <SyndicationItem>();

        foreach (var position in positions)
        {
            var positionUrl =
                new Uri(GetFullyQualifiedUrl("/PositionDetails.aspx") + "?PositionID=" + position.ID.ToString());


            SyndicationItem item = new SyndicationItem();

            item.Title = TextSyndicationContent.CreatePlaintextContent(position.PositionTitle);
            item.Links.Add(SyndicationLink.CreateAlternateLink(positionUrl));
            item.Summary     = TextSyndicationContent.CreatePlaintextContent(position.ShortDescription);
            item.PublishDate = position.DatePosted;

            feedItems.Add(item);
        }

        return(feedItems);
    }
Esempio n. 4
0
        private async Task UpdateSyndicationFeed()
        {
            //See if feed is already in the cache
            List <SyndicationItem> items = Cache["news"] as List <SyndicationItem>;

            if (items == null)
            {
                var container = client.GetContainerReference(companyName.ToLower());
                var blob      = container.GetBlockBlobReference("news/" + "news.rss");
                using (MemoryStream ms = new MemoryStream())
                {
                    await blob.DownloadToStreamAsync(ms);

                    StreamReader reader = new StreamReader(ms);
                    if (reader != null)
                    {
                        reader.BaseStream.Position = 0;
                    }
                    SyndicationFeed audiosList = SyndicationFeed.Load(XmlReader.Create(ms));
                    items = audiosList.Items.ToList <SyndicationItem>();

                    SyndicationItem item = new SyndicationItem();


                    //Create syndication Item
                    item.Title       = TextSyndicationContent.CreatePlaintextContent(name.Text);
                    item.PublishDate = DateTimeOffset.Now;
                    item.Links.Add(SyndicationLink.CreateAlternateLink(uri));
                    item.Summary = TextSyndicationContent.CreatePlaintextContent(description.Text);
                    items.Add(item);

                    //recreate Feed
                    audiosList.Items = items;
                    blob.Delete();

                    MemoryStream       ms1          = new MemoryStream();
                    XmlWriter          feedWriter   = XmlWriter.Create(ms1);
                    Rss20FeedFormatter rssFormatter = new Rss20FeedFormatter(audiosList);
                    rssFormatter.WriteTo(feedWriter);
                    feedWriter.Close();

                    await blob.UploadFromByteArrayAsync(ms1.ToArray(), 0, ms1.ToArray().Length);

                    ms1.Close();
                }
                Cache.Insert("news",
                             items,
                             null,
                             DateTime.Now.AddHours(1.0),
                             TimeSpan.Zero);
            }
        }
Esempio n. 5
0
    private SyndicationFeed CreateFeed()
    {
        var positionsFeed = new SyndicationFeed("UC Davis Recruitments Open Positions", "This feed displays the top 25 positions that are open for applications", Request.Url)
        {
            Copyright = TextSyndicationContent.CreatePlaintextContent(
                "Developed By The College Of Agricultural And Environmental Science Dean's Office")
        };

        List <SyndicationItem> feedItems = CreateFeedItems();

        positionsFeed.Items = feedItems;

        return(positionsFeed);
    }
Esempio n. 6
0
    private static List <SyndicationItem> GetPosts(string pbaseUrl, SortedDictionary <string, dynamic> pPostMetaData)
    {
        var items = new List <SyndicationItem>();

        foreach (var post in pPostMetaData)
        {
            var item = new SyndicationItem();
            item.Title = TextSyndicationContent.CreatePlaintextContent(post.Value.title);
            item.Links.Add(SyndicationLink.CreateAlternateLink(new Uri(pbaseUrl + post.Value.link.url)));
            item.Summary = TextSyndicationContent.CreateHtmlContent(post.Value.summary);
            var date = DateTime.Parse(post.Value.publish_date);
            item.PublishDate = new DateTimeOffset(date);
            item.Authors.Add(new SyndicationPerson(post.Value.author.email, post.Value.author.name, post.Value.author.url));

            items.Add(item);
        }

        return(items);
    }
Esempio n. 7
0
        private void UpdateSyndicationFeed()
        {
            //See if feed is already in the cache
            List <SyndicationItem> items = Cache["AudiosFeed"] as List <SyndicationItem>;

            if (items == null)
            {
                var container = client.GetContainerReference(companyName.ToLower());
                var blob      = container.GetBlockBlobReference("audios/" + "audio.rss");
                using (MemoryStream ms = new MemoryStream())
                {
                    blob.DownloadToStream(ms);
                    StreamReader reader = new StreamReader(ms);
                    if (reader != null)
                    {
                        reader.BaseStream.Position = 0;
                    }
                    SyndicationFeed audiosList = SyndicationFeed.Load(XmlReader.Create(ms));
                    items = audiosList.Items.ToList <SyndicationItem>();
                    //Custom Tags
                    string           prefix   = "itunes";
                    XmlQualifiedName nam      = new XmlQualifiedName(prefix, "http://www.w3.org/2000/xmlns/");
                    XNamespace       itunesNs = "http://www.itunes.com/dtds/podcast-1.0.dtd";
                    audiosList.AttributeExtensions.Add(nam, itunesNs.NamespaceName);
                    SyndicationItem item = new SyndicationItem();


                    //Create syndication Item
                    item.Title       = TextSyndicationContent.CreatePlaintextContent(name.Text);
                    item.PublishDate = DateTimeOffset.Now;
                    item.Links.Add(SyndicationLink.CreateAlternateLink(uri));
                    item.ElementExtensions.Add(new SyndicationElementExtension("author", itunesNs.NamespaceName, name.Text));
                    item.ElementExtensions.Add(new SyndicationElementExtension("explicit", itunesNs.NamespaceName, "no"));
                    item.ElementExtensions.Add(new SyndicationElementExtension("summary", itunesNs.NamespaceName, description.Text));
                    item.ElementExtensions.Add(new SyndicationElementExtension("subtitle", itunesNs.NamespaceName, subtitle.Text));
                    item.ElementExtensions.Add(
                        new XElement(itunesNs + "image", new XAttribute("href", uri2.ToString())));
                    item.ElementExtensions.Add(new SyndicationElementExtension("Size", null, upload_file.PostedFile.ContentLength / 1000000));

                    item.Summary = TextSyndicationContent.CreatePlaintextContent(description.Text);
                    item.Categories.Add(new SyndicationCategory(category.Text));
                    SyndicationLink enclosure = SyndicationLink.CreateMediaEnclosureLink(uri, "audio/mpeg", upload_file.PostedFile.ContentLength);
                    item.ElementExtensions.Add(new SyndicationElementExtension("subtitle", itunesNs.NamespaceName, subtitle.Text));
                    item.Links.Add(enclosure);

                    //create author Info
                    SyndicationPerson authInfo = new SyndicationPerson();
                    authInfo.Name = authorName.Text;
                    item.Authors.Add(authInfo);
                    items.Add(item);

                    //recreate Feed
                    audiosList.Items = items;
                    blob.Delete();

                    MemoryStream       ms1          = new MemoryStream();
                    XmlWriter          feedWriter   = XmlWriter.Create(ms1);
                    Rss20FeedFormatter rssFormatter = new Rss20FeedFormatter(audiosList);
                    rssFormatter.WriteTo(feedWriter);
                    feedWriter.Close();

                    blob.UploadFromByteArray(ms1.ToArray(), 0, ms1.ToArray().Length);
                    ms1.Close();
                }
                Cache.Insert("AudiosFeed",
                             items,
                             null,
                             DateTime.Now.AddHours(1.0),
                             TimeSpan.Zero);
            }
        }
Esempio n. 8
0
        public static string GetFeed(QuickParameters quickParameters, string type)
        {
            string urlPrefix = System.Configuration.ConfigurationManager.AppSettings["HostName"] + HttpContext.Current.Request.ApplicationPath;

            UserDataContext udc = UserDataContext.GetUserDataContext();

            quickParameters.Udc         = udc;
            quickParameters.ObjectTypes = QuickParameters.GetDelimitedObjectTypeIDs(rssEngineConfig.ObjectTypes, ',');
            quickParameters.SortBy      = QuickSort.StartDate;
            //quickParameters.FromStartDate = DateTime.Now - new TimeSpan(rssEngineConfig.Days, 0, 0, 0);
            quickParameters.Amount   = rssEngineConfig.MaxItems;
            quickParameters.PageSize = rssEngineConfig.MaxItems;

            StringBuilder   sb;
            List <string>   titleSegments = new List <string>();
            SyndicationFeed feed          = new SyndicationFeed();

            if (quickParameters.CommunityID.HasValue)
            {
                DataObjectCommunity channelCommunity = DataObject.Load <DataObjectCommunity>(quickParameters.CommunityID);
                if (channelCommunity.State != ObjectState.Added)
                {
                    if (channelCommunity.ObjectType == Helper.GetObjectTypeNumericID("ProfileCommunity"))
                    {
                        titleSegments.Add(string.Format("Von {0}", channelCommunity.Nickname));
                    }
                    else
                    {
                        titleSegments.Add(string.Format("Von {0}", channelCommunity.Title));
                    }
                }
            }
            else if (quickParameters.UserID.HasValue)
            {
                Business.DataObjectUser channelUser = DataObject.Load <DataObjectUser>(quickParameters.UserID);
                if (channelUser.State != ObjectState.Added)
                {
                    titleSegments.Add(string.Format("Von {0}", channelUser.Nickname));
                }
            }
            if (!string.IsNullOrEmpty(quickParameters.RawTags1) || !string.IsNullOrEmpty(quickParameters.RawTags2) || !string.IsNullOrEmpty(quickParameters.RawTags3))
            {
                titleSegments.Add(string.Format("Tags {0}", Helper.GetTagWordString(new List <string>()
                {
                    quickParameters.RawTags1, quickParameters.RawTags2, quickParameters.RawTags3
                })));
            }

            sb = new StringBuilder();
            if (titleSegments.Count > 0)
            {
                for (int i = 0; i < titleSegments.Count; i++)
                {
                    sb.Append(titleSegments[i]);
                    if (i < titleSegments.Count - 1)
                    {
                        sb.Append(", ");
                    }
                }
            }
            else
            {
                sb.Append("Alles");
            }
            string title       = string.Format("{0} Feed - {1}", siteName, sb.ToString());
            string description = "RSS Feed von " + siteName;

            feed.Title       = TextSyndicationContent.CreatePlaintextContent(title);
            feed.Description = TextSyndicationContent.CreatePlaintextContent(description);
            feed.Links.Add(new SyndicationLink(new Uri(urlPrefix)));
            feed.Language = "de-CH";

            List <SyndicationItem>      items    = new List <SyndicationItem>();
            DataObjectList <DataObject> rssItems = DataObjects.Load <DataObject>(quickParameters);

            foreach (DataObject rssItem in rssItems)
            {
                SyndicationItem item = new SyndicationItem();

                // Add prefix to title
                item.Title = TextSyndicationContent.CreatePlaintextContent("[" + Helper.GetObjectName(rssItem.ObjectType, true) + "] " + rssItem.Title);

                // Set owner as author
                SyndicationPerson author = new SyndicationPerson();
                author.Name = rssItem.Nickname;
                item.Authors.Add(author);

                // Set object's guid
                item.Id = rssItem.objectID.Value.ToString();

                // Link to the object
                string itemUrl = urlPrefix + Helper.GetDetailLink(rssItem.ObjectType, rssItem.objectID.Value.ToString());
                item.AddPermalink(new Uri(itemUrl));

                // Take start date as publish date
                item.PublishDate = rssItem.StartDate;

                // Image if available
                if (!string.IsNullOrEmpty(rssItem.GetImage(PictureVersion.S)) && rssItem.GetImage(PictureVersion.S).ToLower() != Helper.GetDefaultURLImageSmall(rssItem.ObjectType).ToLower())
                {
                    item.Content = SyndicationContent.CreateXhtmlContent("<div><a href=\"" + itemUrl + "\"><img src=\"" + System.Configuration.ConfigurationManager.AppSettings["MediaDomainName"] + rssItem.GetImage(PictureVersion.S) + "\"></a></div><div>" + rssItem.Description.StripHTMLTags().CropString(rssEngineConfig.MaxDescriptionLength) + "</div>");
                }
                else
                {
                    item.Content = TextSyndicationContent.CreatePlaintextContent(rssItem.Description.StripHTMLTags().CropString(rssEngineConfig.MaxDescriptionLength));
                }

                items.Add(item);
            }

            feed.Items = items;

            sb = new StringBuilder();
            XmlWriter xmlWriter = XmlWriter.Create(sb);

            if (type == "rss")
            {
                feed.SaveAsRss20(xmlWriter);
            }
            else if (type == "atom")
            {
                feed.SaveAsAtom10(xmlWriter);
            }
            xmlWriter.Close();

            string feedXml = sb.ToString();

            feedXml = Regex.Replace(feedXml, @"^<.*?xml.*?>\s*", "");
            return(feedXml);
        }
Esempio n. 9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ContentQuery contentQuery = new ContentQuery
            {
                ContentTypeID            = (int)SueetieContentType.BlogPost,
                CacheMinutes             = 5,
                SueetieContentViewTypeID = (int)SueetieContentViewType.AggregateBlogPostList
            };
            List <SueetieBlogPost> sueetieBlogPosts = SueetieBlogs.GetSueetieBlogPostList(contentQuery);
            var dataItems = from post in sueetieBlogPosts
                            orderby post.DateCreated descending
                            select post;

            const int maxItemsInFeed = 10;

            // Determine whether we're outputting an Atom or RSS feed
            bool outputAtom = (Request.QueryString["Type"] == "ATOM");
            bool outputRss  = !outputAtom;

            if (outputRss)
            {
                Response.ContentType = "application/rss+xml";
            }
            else if (outputAtom)
            {
                Response.ContentType = "application/atom+xml";
            }

            // Create the feed and specify the feed's attributes
            SyndicationFeed myFeed = new SyndicationFeed();

            myFeed.Title       = TextSyndicationContent.CreatePlaintextContent("Most Recent Posts on " + SiteSettings.Instance.SiteName);
            myFeed.Description = TextSyndicationContent.CreatePlaintextContent("A syndication of the most recently published posts on " + SiteSettings.Instance.SiteName);
            myFeed.Links.Add(SyndicationLink.CreateAlternateLink(new Uri(GetFullyQualifiedUrl("~/Default.aspx"))));
            myFeed.Links.Add(SyndicationLink.CreateSelfLink(new Uri(GetFullyQualifiedUrl(Request.RawUrl))));
            myFeed.Copyright = TextSyndicationContent.CreatePlaintextContent("Copyright " + SiteSettings.Instance.SiteName);
            myFeed.Language  = "en-us";

            List <SyndicationItem> feedItems = new List <SyndicationItem>();

            foreach (SueetieBlogPost p in dataItems.Take(maxItemsInFeed))
            {
                if (outputAtom && p.Author == null)
                {
                    continue;
                }

                SyndicationItem item = new SyndicationItem();
                item.Title = TextSyndicationContent.CreatePlaintextContent(p.BlogTitle + " - " + p.Title);
                item.Links.Add(SyndicationLink.CreateAlternateLink(new Uri(GetFullyQualifiedUrl(p.Permalink))));
                item.Summary = TextSyndicationContent.CreateHtmlContent(p.PostContent);
                item.Categories.Add(new SyndicationCategory(p.BlogTitle));
                item.PublishDate = p.DateCreated;
                item.Id          = GetFullyQualifiedUrl(p.Permalink);
                SyndicationPerson authInfo = new SyndicationPerson();
                authInfo.Email = p.Email;
                authInfo.Name  = p.DisplayName;
                item.Authors.Add(authInfo);

                feedItems.Add(item);
            }

            myFeed.Items = feedItems;

            XmlWriterSettings outputSettings = new XmlWriterSettings();

            outputSettings.Indent = true;
            XmlWriter feedWriter = XmlWriter.Create(Response.OutputStream, outputSettings);

            if (outputAtom)
            {
                Atom10FeedFormatter atomFormatter = new Atom10FeedFormatter(myFeed);
                atomFormatter.WriteTo(feedWriter);
            }
            else if (outputRss)
            {
                Rss20FeedFormatter rssFormatter = new Rss20FeedFormatter(myFeed);
                rssFormatter.WriteTo(feedWriter);
            }

            feedWriter.Close();
        }
        private void GenerateFeed()
        {
            CertificateTableAdapter certificateAdapter = new CertificateTableAdapter();


            String description = "";

            String siteUrl     = "http://" + EnvDomain;
            String homePageUrl = siteUrl + ResolveUrl("~/Default.aspx") + "?station_id=" + StationId;

            //mainFeed.Title = TextSyndicationContent.CreatePlaintextContent(Station.SiteNamePlainText);
            //mainFeed.Links.Add(SyndicationLink.CreateSelfLink(new Uri(homePageUrl)));


            List <DollarSaverDB.CertificateRow> listCertificates = new List <DollarSaverDB.CertificateRow>();

            if (Station.StationSiteType == SiteType.Standard)
            {
                SpecialSettingsTableAdapter            specialSettingsAdapter = new SpecialSettingsTableAdapter();
                DollarSaverDB.SpecialSettingsDataTable specialSettingsTable   = specialSettingsAdapter.GetSpecialSettings(StationId);

                bool dailyHeader = false;
                if (specialSettingsTable.Count == 1)
                {
                    dailyHeader = specialSettingsTable[0].DailyHeader;
                }

                if (dailyHeader)
                {
                    description = "Daily Deal";
                }
                else
                {
                    description = "Weekly Deal";
                }

                DollarSaverDB.CertificateDataTable daily = certificateAdapter.GetSpecial(StationId, 1);
                if (daily.Count == 1)
                {
                    listCertificates.Add(daily[0]);
                }
            }
            else
            {
                description = "Deal of the Week";

                DollarSaverDB.CertificateDataTable certificateTable = certificateAdapter.GetCurrentDeal(StationId);

                if (certificateTable.Count == 1)
                {
                    listCertificates.Add(certificateTable[0]);
                }
            }

            List <SyndicationItem> items = new List <SyndicationItem>();

            foreach (DollarSaverDB.CertificateRow certificate in listCertificates)
            {
                SyndicationItem item = new SyndicationItem();

                item.Title = TextSyndicationContent.CreatePlaintextContent(certificate.AdvertiserName);

                String advertiserUrl = siteUrl + ResolveUrl("~/Advertiser.aspx?advertiser_id=" + certificate.AdvertiserId);

                item.Links.Add(SyndicationLink.CreateAlternateLink(new Uri(advertiserUrl)));


                StringBuilder content = new StringBuilder();


                if (certificate.Advertiser.LogoUrl != String.Empty)
                {
                    String logoUrl = siteUrl + ResolveUrl(certificate.Advertiser.LogoUrl);

                    int logoWidth  = 125;
                    int logoHeight = 75;

                    if (certificate.Advertiser.IsLogoImageVertical)
                    {
                        logoWidth  = 75;
                        logoHeight = 125;
                    }

                    content.Append("<div>");
                    content.Append("<a href=\"" + advertiserUrl + "\">");
                    content.Append("<img src=\"" + logoUrl + "\"  alt=\"" + Server.HtmlEncode(certificate.AdvertiserName) + "\" style=\"border-color:#404040;border-width:1px;border-style:solid;height:" + logoHeight + "px;width:" + logoWidth + "px;\">");
                    content.Append("</a>");
                    content.Append("</div>");
                }

                content.Append("<div style=\"font-family: Arial;\">");

                //content.Append("<a href=\"" + advertiserUrl + "\" style=\"font-weight: bold; font-size: 1.3em; line-height: 1.7em;\">" + Server.HtmlEncode(certificate.AdvertiserName) + "</a>");

                content.Append("<p>");
                content.Append(certificate.Advertiser.Description);
                content.Append("</p>");
                content.Append("<a href=\"" + advertiserUrl + "\" style=\"font-weight: bold; font-size: 1.1em; line-height: 1.5em;\">" + Server.HtmlEncode(certificate.ShortName) + "<a>");
                content.Append("<p> ");
                content.Append(certificate.Description);
                content.Append("</p>");
                content.Append("<p style=\"font-weight: bold;\"> ");
                content.Append("Certificate Value: " + certificate.FaceValue.ToString("$0.00") + "<br />");
                content.Append("Price: <span style=\"color: red;\">" + certificate.DiscountValue.ToString("$0.00") + "</span><br />");
                content.Append("Your Savings: " + certificate.Savings + "<br />");
                content.Append("</p>");
                content.Append("<a href=\"" + advertiserUrl + "\" style=\"font-weight: bold; font-size: 1.1em; line-height: 1.5em;\">BUY NOW</a>");
                content.Append("</div>");
                content.Append("<div style=\"clear: both;\"></div>");


                item.Content = SyndicationContent.CreateHtmlContent(content.ToString());

                items.Add(item);
            }


            SyndicationFeed mainFeed = new SyndicationFeed(Station.SiteNamePlainText, description, new Uri(homePageUrl));

            mainFeed.Description = TextSyndicationContent.CreatePlaintextContent(description);

            mainFeed.Items = items;

            Response.ContentType = "application/rss+xml";

            using (XmlWriter xmlWriter = XmlWriter.Create(Response.OutputStream)) {
                Rss20FeedFormatter rssFeed = new Rss20FeedFormatter(mainFeed);
                rssFeed.WriteTo(xmlWriter);
            }
        }
Esempio n. 11
0
        public static string GetPlaylistFeed(Guid?objectId, VideoFormat videoFormat, VideoVersion videoVersion)
        {
            UserDataContext udc = UserDataContext.GetUserDataContext();

            DataObjectVideo     dataObjectVideo = DataObject.Load <DataObjectVideo>(objectId);
            DataObjectCommunity community       = DataObject.Load <DataObjectCommunity>(dataObjectVideo.CommunityID);

            QuickParameters quickParameters = new QuickParameters();

            quickParameters.Udc        = udc;
            quickParameters.ObjectType = Helper.GetObjectTypeNumericID("Video");
            quickParameters.SortBy     = QuickSort.StartDate;
            quickParameters.Amount     = 100;
            quickParameters.PageSize   = 100;
            quickParameters.PageNumber = 1;
            quickParameters.ShowState  = ObjectShowState.Published;
            if (community.ObjectType == Helper.GetObjectTypeNumericID("Community"))
            {
                quickParameters.CommunityID = community.ObjectID;
            }
            else if (community.ObjectType == Helper.GetObjectTypeNumericID("ProfileCommunity"))
            {
                quickParameters.UserID = community.UserID;
            }

            MediaSyndicationFeed feed = new MediaSyndicationFeed();

            string title = string.Empty;

            if (community.ObjectType == Helper.GetObjectTypeNumericID("Community"))
            {
                title = "Video aus " + community.Title;
            }
            else if (community.ObjectType == Helper.GetObjectTypeNumericID("ProfileCommunity"))
            {
                title = "Videos von " + community.Nickname;
            }

            feed.Title = TextSyndicationContent.CreatePlaintextContent(title);

            //feed.Description = TextSyndicationContent.CreatePlaintextContent("");
            string feedUrl = SiteConfig.SiteURL + Helper.GetDetailLink(community.ObjectType, community.ObjectID.Value.ToString());

            feed.Links.Add(new SyndicationLink(new Uri(feedUrl)));
            feed.Language = "de-CH";

            List <SyndicationItem>           items  = new List <SyndicationItem>();
            DataObjectList <DataObjectVideo> videos = DataObjects.Load <DataObjectVideo>(quickParameters);

            foreach (DataObjectVideo video in videos)
            {
                MediaSyndicationItem item = new MediaSyndicationItem();

                item.MediaContentUrl      = new Uri(string.Format("{0}{1}", Helper.GetVideoBaseURL(), video.GetLocation(videoFormat, videoVersion)));
                item.MediaContentDuration = video.DurationSecond;
                item.MediaContentType     = "video/x-flv";
                item.MediaThumbnailUrl    = new Uri(string.Format("{0}{1}", SiteConfig.MediaDomainName, video.GetImage(PictureVersion.S)));
                item.MediaKeywords        = video.TagList.Replace(Constants.TAG_DELIMITER.ToString(), ", ");
                item.MediaCredit          = video.Nickname;

                item.Title = TextSyndicationContent.CreatePlaintextContent(video.Title.StripHTMLTags());

                item.Id = video.ObjectID.Value.ToString();

                string itemUrl = SiteConfig.SiteURL + Helper.GetDetailLink(video.ObjectType, video.ObjectID.Value.ToString());
                item.AddPermalink(new Uri(itemUrl));

                item.PublishDate = video.StartDate;

                items.Add(item);
            }

            feed.Items = items;

            StringBuilder     sb       = new StringBuilder();
            XmlWriterSettings settings = new XmlWriterSettings();

            settings.Indent = true;
            XmlWriter xmlWriter = XmlWriter.Create(sb, settings);

            feed.SaveAsRss20(xmlWriter);
            xmlWriter.Close();

            string feedXml = sb.ToString();

            feedXml = Regex.Replace(feedXml, @"^<.*?xml.*?>\s*", "");
            return(feedXml);
        }