コード例 #1
0
ファイル: Album.cs プロジェクト: mesika/mono-smugmug
        /// <summary>
        /// Retrieves a list of images for a given album (Album with id, Key, ImageCount, and Image array with id, Key, Altitude, Caption, Date, FileName, Duration, Format, Heaight, Hidden, Keywords, LargeURL, LastUpdated, Latitude, Longitude, MD5Sum, MediumURL, OriginalURL, Position, Serial, Size, SmallURL, ThumbURL, TinyURL, Video320URL, Video640URL, Video960URL, Video1280URL, Video1920URL, Width, X2LardeURL, X3LargeURL, XLargeURL)
        /// </summary>
        /// <param name="Associative">boolean, returns an associative array. Default: false</param>
        /// <param name="Extras">A comma seperated string of additional attributes to return in the response.</param>
        /// <param name="Heavy">heavy response. Default : false</param>
        /// <param name="LastUpdated">Return results where LastUpdated is after the epoch time provided</param>
        /// <param name="Sandboxed">Forces URLs to a location with a crossdomain.xml file. Default: false  </param>
        /// <param name="SitePassword">The site password for a specific user</param>
        /// <returns>List of Images</returns>
        public async Task<List<Image>> GetImagesAsync(bool Associative, string Extras, bool Heavy, int LastUpdated, bool Sandboxed, string SitePassword)
        {
            CommunicationHelper ch = new CommunicationHelper();
            // SessionID [required], AlbumID [required], AlbumKey [required], Callback, Extras, Heavy, LastUpdated, Password, Pretty, Sandboxed (boolean. Forces URLs to a location with a crossdomain.xml file. Default: false), SitePassword, Strict
            ImageResponse resp = new ImageResponse();
            if ((Password != null) && (Password != String.Empty))
                resp = await ch.ExecuteMethod<ImageResponse>("smugmug.images.get", basic, "AlbumID", id, "AlbumKey", Key, "Associative", Associative, "Extras", Extras, "Heavy", Heavy, "LastUpdated", LastUpdated, "Sandboxed", Sandboxed, "SitePassword", SitePassword, "Password", Password);
            else
                resp = await ch.ExecuteMethod<ImageResponse>("smugmug.images.get", basic, "AlbumID", id, "AlbumKey", Key, "Associative", Associative, "Extras", Extras, "Heavy", Heavy, "LastUpdated", LastUpdated, "Sandboxed", Sandboxed, "SitePassword", SitePassword);

            if (resp.stat == "ok")
            {
                var imageList = new List<Image>();
                imageList.AddRange(resp.Album.Images);
                this.ImageCount = resp.Album.ImageCount;
                if (imageList != null)
                {
                    foreach (var item in imageList)
                    {
                        item.basic = basic;
                        item.Album = this;
                    }
                }
                return imageList;
            }
            else
            {
                Console.WriteLine(resp.message);
                throw new SmugMugException(resp.code, resp.message, resp.method);
            }
        }
コード例 #2
0
ファイル: Album.cs プロジェクト: mesika/mono-smugmug
        /// <summary>
        /// Retrieves a list of images for a given album (Album with id, Key, ImageCount, and Image array with id, Key, Altitude, Caption, Date, FileName, Duration, Format, Heaight, Hidden, Keywords, LargeURL, LastUpdated, Latitude, Longitude, MD5Sum, MediumURL, OriginalURL, Position, Serial, Size, SmallURL, ThumbURL, TinyURL, Video320URL, Video640URL, Video960URL, Video1280URL, Video1920URL, Width, X2LardeURL, X3LargeURL, XLargeURL)
        /// </summary>
        /// <param name="Associative">boolean, returns an associative array. Default: false</param>
        /// <param name="Extras">A comma seperated string of additional attributes to return in the response.</param>
        /// <param name="Heavy">heavy response. Default : false</param>
        /// <param name="LastUpdated">Return results where LastUpdated is after the epoch time provided</param>
        /// <param name="Sandboxed">Forces URLs to a location with a crossdomain.xml file. Default: false  </param>
        /// <param name="SitePassword">The site password for a specific user</param>
        /// <returns>List of Images</returns>
        public List<Image> GetImages(bool Associative, string Extras, bool Heavy, int LastUpdated, bool Sandboxed, string SitePassword)
        {
            System.Diagnostics.Stopwatch stopWatch = new System.Diagnostics.Stopwatch();
            stopWatch.Start();
            _logger.Debug("Getting images from smugmug with heave={0}", Header);
            CommunicationHelper ch = new CommunicationHelper();
            // SessionID [required], AlbumID [required], AlbumKey [required], Callback, Extras, Heavy, LastUpdated, Password, Pretty, Sandboxed (boolean. Forces URLs to a location with a crossdomain.xml file. Default: false), SitePassword, Strict
            ImageResponse resp = new ImageResponse();
            if ((Password != null) && (Password != String.Empty))
                resp = ch.ExecuteMethod<ImageResponse>("smugmug.images.get", basic, "AlbumID", id, "AlbumKey", Key, "Associative", Associative, "Extras", Extras, "Heavy", Heavy, "LastUpdated", LastUpdated, "Sandboxed", Sandboxed,"SitePassword", SitePassword, "Password", Password);
            else
                resp = ch.ExecuteMethod<ImageResponse>("smugmug.images.get", basic, "AlbumID", id, "AlbumKey", Key, "Associative", Associative, "Extras", Extras, "Heavy", Heavy, "LastUpdated", LastUpdated, "Sandboxed", Sandboxed,"SitePassword", SitePassword);

               			_logger.Debug("Finished getting images from smugmug in {0:n} milliseconds.", stopWatch.ElapsedMilliseconds);
            stopWatch.Stop();
            if (resp.stat == "ok")
            {
                _logger.Debug("Smugmug images.get response was ok.");

                var imageList = new List<Image>();
                imageList.AddRange(resp.Album.Images);
                this.ImageCount = resp.Album.ImageCount;
                if (imageList != null)
                {
                    foreach (var item in imageList)
                    {
                        item.basic = basic;
                        item.Album = this;
                    }
                }
                return imageList;
            }
            else
            {
                Console.WriteLine(resp.message);
                throw new SmugMugException(resp.code, resp.message, resp.method);
            }
        }
コード例 #3
0
ファイル: Image.cs プロジェクト: mesika/mono-smugmug
        /// <summary>
        /// Populate the current image with all the URLs for the various sizes from the site. The Album must be owned by the Session holder, or else be Public (if password-protected, a Password must be provided), to return results. Otherwise, an "invalid user" faultCode will result. Additionally, obvious restrictions on Originals and Larges apply if so set by the owner. They will return as empty strings for those URLs if they're unavailable
        /// </summary>
        /// <param name="Sandboxed">Forces URLs to a location with a crossdomain.xml file. Default: false</param>
        /// <param name="SitePassword">The site password for a specific user</param>
        /// <returns></returns>
        public void PopulateImageWithURLsFromSite(bool Sandboxed, string SitePassword, string CustomSize)
        {
            CommunicationHelper ch = new CommunicationHelper();
            // SessionID [required], ImageId [required], ImageKey [required], Callback, Password, Pretty, Sandboxed, SitePassword, Strict, TemplateID
            ImageResponse resp = new ImageResponse();
            if ((Album != null) && (Album.Password != null) && (Album.Password != String.Empty))
                resp = ch.ExecuteMethod<ImageResponse>("smugmug.images.getURLs", basic, "ImageID", id, "ImageKey", Key, "Sandboxed", Sandboxed, "SitePassword", SitePassword, "Password", Album.Password, "CustomSize", CustomSize);
            else
                resp = ch.ExecuteMethod<ImageResponse>("smugmug.images.getURLs", basic, "ImageID", id, "ImageKey", Key, "Sandboxed", Sandboxed, "SitePassword", SitePassword, "CustomSize", CustomSize);

            if (resp.stat == "ok")
            {
                PopulateWithResponse(resp.Image, this);
            }
            else
            {
                Console.WriteLine(resp.message);
                throw new SmugMugException(resp.code, resp.message, resp.method);
            }
        }
コード例 #4
0
ファイル: Image.cs プロジェクト: mesika/mono-smugmug
 /// <summary>
 /// Return all the URLs for the various sizes of the image specified by ImageID. The Album must be owned by the Session holder, or else be Public (if password-protected, a Password must be provided), to return results. Otherwise, an "invalid user" faultCode will result. Additionally, obvious restrictions on Originals and Larges apply if so set by the owner. They will return as empty strings for those URLs if they're unavailable
 /// </summary> 
 /// <param name="Sandboxed">Forces URLs to a location with a crossdomain.xml file. Default: false</param>
 /// <param name="SitePassword">The site password for a specific user</param>
 /// <param name="CustomSize"></param>
 /// <returns>Image</returns>
 public Image GetURLs(bool Sandboxed, string SitePassword, string CustomSize)
 {
     CommunicationHelper ch = new CommunicationHelper();
     // SessionID [required], ImageId [required], ImageKey [required], Callback, CustomSize, Password, Pretty, Sandboxed (boolean. Forces URLs to a location with a crossdomain.xml file. Default: false), SitePassword, Strict, TemplateID
     ImageResponse resp = new ImageResponse();
     if ((Album != null) && (Album.Password != null) && (Album.Password != String.Empty))
         resp = ch.ExecuteMethod<ImageResponse>("smugmug.images.getURLs", basic, "ImageID", id, "ImageKey", Key, "Sandboxed", Sandboxed, "SitePassword", SitePassword, "Password", Album.Password, "CustomSize", CustomSize);
     else
         resp = ch.ExecuteMethod<ImageResponse>("smugmug.images.getURLs", basic, "ImageID", id, "ImageKey", Key, "Sandboxed", Sandboxed, "SitePassword", SitePassword, "CustomSize", CustomSize);
     if (resp.stat == "ok")
     {
         var temp = resp.Image;
         temp.basic = basic;
         return temp;
     }
     else
     {
         Console.WriteLine(resp.message);
         throw new SmugMugException(resp.code, resp.message, resp.method);
     }
 }
コード例 #5
0
ファイル: Image.cs プロジェクト: mesika/mono-smugmug
 /// <summary>
 /// Returns camera and photograph details about an image (id, Key, Aperture, Brightness, CCDWidth, ColorSpace, CompressedBitsPixel, Contrast, DateTime, DateTimeDigitized, DateTimeOriginal, DigitalZoomRatio, ExposureBias, ExposureMode, ExposureProgram, ExposureTime, Flash, FocalLength, FocalLengthIn35mmFilm, ISO, LightSource, Make, Metering, Model, Saturation, SensingMethod, Sharpness, SubjectDistance, SubjectDistanceRange, WhiteBalance). The Album must be owned by the Session holder, or else be Public (if password-protected, a Password must be provided), to return results. Otherwise, an "invalid user" faultCode will result. Additionally, the album owner must have specified that EXIF data is allowed. Note that many photos have no EXIF data, so an empty or partially returned result is very normal
 /// </summary>
 /// <param name="SitePassword">The site password for a specific user</param>
 /// <returns>Image with properties id, Key, Aperture, Brightness, CCDWidth, ColorSpace, CompressedBitsPixel, Contrast, DateTime, DateTimeDigitized, DateTimeOriginal, DigitalZoomRatio, ExposureBias, ExposureMode, ExposureProgram, ExposureTime, Flash, FocalLength, FocalLengthIn35mmFilm, ISO, LightSource, Make, Metering, Model, Saturation, SensingMethod, Sharpness, SubjectDistance, SubjectDistanceRange, WhiteBalance)</returns>
 public Image GetEXIF(string SitePassword)
 {
     CommunicationHelper ch = new CommunicationHelper();
     // SessionID [required], ImageId [required], ImageKey [required], Callback, Password, Pretty, SitePassword, Strict
     ImageResponse resp = new ImageResponse();
     if ((Album != null) && (Album.Password != null) && (Album.Password != String.Empty))
         resp = ch.ExecuteMethod<ImageResponse>("smugmug.images.getEXIF", basic, "ImageID", id, "ImageKey", Key, "SitePassword", SitePassword, "Password", Album.Password);
     else
         resp = ch.ExecuteMethod<ImageResponse>("smugmug.images.getEXIF", basic, "ImageID", id, "ImageKey", Key, "SitePassword", SitePassword);
     if (resp.stat == "ok")
     {
         var temp = resp.Image;
         temp.basic = basic;
         temp.Key = Key;
         return temp;
     }
     else
     {
         Console.WriteLine(resp.message);
         throw new SmugMugException(resp.code, resp.message, resp.method);
     }
 }
コード例 #6
0
ファイル: Image.cs プロジェクト: mesika/mono-smugmug
 /// <summary>
 /// Retrieves a list of comments for an image
 /// </summary>
 /// <param name="Associative">Returns an associative array. Default: false</param>
 /// <param name="LastUpdated">Return results where LastUpdated is after the epoch time provided</param>
 /// <param name="SitePassword">The site password for a specific user</param>
 public void GetComments(bool Associative, int LastUpdated, string SitePassword)
 {
     CommunicationHelper ch = new CommunicationHelper();
     // SessionID [required], ImageId [required], ImageKey [required], Associative, Callback, LastUpdated, Password, Pretty, SitePassword, Strict
     ImageResponse resp = new ImageResponse();
     if ((Album != null) && (!String.IsNullOrEmpty(Album.Password)))
         resp = ch.ExecuteMethod<ImageResponse>("smugmug.images.comments.get", basic, "ImageID", id, "ImageKey", Key, "SitePassword", SitePassword, "Password", Album.Password, "LastUpdated", LastUpdated, "Associative", Associative);
     else
         resp = ch.ExecuteMethod<ImageResponse>("smugmug.images.comments.get", basic, "ImageID", id, "ImageKey", Key, "SitePassword", SitePassword, "LastUpdated", LastUpdated, "Associative", Associative);
     if (resp.stat == "ok")
     {
         if (this.Comments == null)
             this.Comments = new List<Comment>();
         this.Comments = resp.Image.Comments;
     }
     else
     {
         Console.WriteLine(resp.message);
         throw new SmugMugException(resp.code, resp.message, resp.method);
     }
 }
コード例 #7
0
ファイル: Image.cs プロジェクト: mesika/mono-smugmug
        /// <summary>
        /// Populate the current image with camera and photograph details (id, Key, Aperture, Brightness, CCDWidth, ColorSpace, CompressedBitsPixel, Contrast, DateTime, DateTimeDigitized, DateTimeOriginal, DigitalZoomRatio, ExposureBias, ExposureMode, ExposureProgram, ExposureTime, Flash, FocalLength, FocalLengthIn35mmFilm, ISO, LightSource, Make, Metering, Model, Saturation, SensingMethod, Sharpness, SubjectDistance, SubjectDistanceRange, WhiteBalance). The Album must be owned by the Session holder, or else be Public (if password-protected, a Password must be provided), to return results. Otherwise, an "invalid user" faultCode will result. Additionally, the album owner must have specified that EXIF data is allowed. Note that many photos have no EXIF data, so an empty or partially returned result is very normal
        /// </summary>
        /// <param name="SitePassword">The site password for a specific user</param>
        public async Task PopulateImageWithEXIFFromSiteAsync(string SitePassword)
        {
            CommunicationHelper ch = new CommunicationHelper();
            // SessionID [required], ImageId [required], ImageKey [required], Callback, Password, Pretty, SitePassword, Strict
            ImageResponse resp = new ImageResponse();
            if ((Album != null) && (Album.Password != null) && (Album.Password != String.Empty))
                resp = await ch.ExecuteMethod<ImageResponse>("smugmug.images.getEXIF", basic, "ImageID", id, "ImageKey", Key, "SitePassword", SitePassword, "Password", Album.Password);
            else
                resp = await ch.ExecuteMethod<ImageResponse>("smugmug.images.getEXIF", basic, "ImageID", id, "ImageKey", Key, "SitePassword", SitePassword);

            if (resp.stat == "ok")
            {
                PopulateWithResponse(resp.Image, this);
            }
            else
            {
                Console.WriteLine(resp.message);
                throw new SmugMugException(resp.code, resp.message, resp.method);
            }
        }