Esempio n. 1
0
        private VimeoApiResult ParseVimeoXmlResponse(string xmlText)
        {
            var xml    = XElement.Parse(xmlText);
            var result = new VimeoApiResult();

            result.ID          = (from c in xml.Descendants("id") select c).First().Value;
            result.Title       = (from c in xml.Descendants("title") select c).First().Value;
            result.Description = (from c in xml.Descendants("description") select c).First().Value;
            result.Published   = (from c in xml.Descendants("upload_date") select c).First().Value;
            result.Thumbnail   = (from c in xml.Descendants("thumbnail_medium") select c).First().Value;
            result.Success     = "true";
            var authorName = (from c in xml.Descendants("user_name") select c).First().Value;
            var authorUri  = (from c in xml.Descendants("user_url") select c).First().Value;

            result.Author = string.Format("<a href='{0}'>{1}</a>", authorUri, authorName);

            return(result);
        }
Esempio n. 2
0
        public Media CreateVimeoMedia(Media obj, Guid objID, VimeoApiResult vimeoResult)
        {
            var    imgID    = Guid.NewGuid().ToString().Substring(0, 12);
            string fileName = string.Format("{0}.jpg", imgID);

            using (Stream stream = new ImageDownloader().DownloadImageAsStream(vimeoResult.Thumbnail))
            {
                imgManager.SaveThumb75x75_MediumCompressed(stream, ImageManager.MediaPhotosTmPath, fileName);
            }

            obj.FeedVisible = true; //-- Movies are always visible

            obj.TypeID      = (byte)MediaType.Vimeo;
            obj.Content     = (new VimeoMediaData()
            {
                Thumbnail = fileName, VimeoID = vimeoResult.ID
            }).ToJson();
            obj.ContentType = "application/json";
            obj.Description = vimeoResult.Description;
            obj.Author      = vimeoResult.Author;
            obj.TakenDate   = DateTime.Parse(vimeoResult.Published).Date;

            return(CreateMedia(obj, objID));
        }
Esempio n. 3
0
        public Media CreateVimeoMedia(Media obj, Guid objID, VimeoApiResult vimeoResult)
        {
            var imgID = Guid.NewGuid().ToString().Substring(0, 12);
            string fileName = string.Format("{0}.jpg", imgID);

            using (Stream stream = new ImageDownloader().DownloadImageAsStream(vimeoResult.Thumbnail))
            {
                imgManager.SaveThumb75x75_MediumCompressed(stream, ImageManager.MediaPhotosTmPath, fileName);
            }

            obj.FeedVisible = true; //-- Movies are always visible

            obj.TypeID = (byte)MediaType.Vimeo;
            obj.Content = (new VimeoMediaData() { Thumbnail = fileName, VimeoID = vimeoResult.ID }).ToJson();
            obj.ContentType = "application/json";
            obj.Description = vimeoResult.Description;
            obj.Author = vimeoResult.Author;
            obj.TakenDate = DateTime.Parse(vimeoResult.Published).Date;

            return CreateMedia(obj, objID);
        }
Esempio n. 4
0
        private VimeoApiResult ParseVimeoXmlResponse(string xmlText)
        {
            var xml = XElement.Parse(xmlText);
            var result = new VimeoApiResult();
            result.ID = (from c in xml.Descendants("id") select c).First().Value;
            result.Title = (from c in xml.Descendants("title") select c).First().Value;
            result.Description = (from c in xml.Descendants("description") select c).First().Value;
            result.Published = (from c in xml.Descendants("upload_date") select c).First().Value;
            result.Thumbnail = (from c in xml.Descendants("thumbnail_medium") select c).First().Value;
            result.Success = "true";
            var authorName = (from c in xml.Descendants("user_name") select c).First().Value;
            var authorUri = (from c in xml.Descendants("user_url") select c).First().Value;
            result.Author = string.Format("<a href='{0}'>{1}</a>", authorUri, authorName);

            return result;
        }
Esempio n. 5
0
        public string SavePersonalityMediaVimeo(string name, PersonalityCategory category, VimeoApiResult youTubeData)
        {
            var media = new Media()
            {
                Title = name
            };

            new MediaService().CreateVimeoMedia(media, currentUser.UserID, youTubeData);

            new UserPersonalityMediaRepository().Create(
                new UserPersonalityMedia()
            {
                ID = Guid.NewGuid(), CategoryID = (byte)category, MediaID = media.ID, UserID = currentUserID
            });

            return(media.Content);
        }