public GoogleContent(GooglePhotosService service, DiscretePicasaAlbum picasaAlbum, Picasa.Photo picasaPhoto) { File = GoogleFileSystem.Instance.File(service, picasaAlbum, picasaPhoto); Dimensions = new PhotoDimensions { Width = picasaPhoto.Width, Height = picasaPhoto.Height, }; findBestContent(picasaPhoto); findTimestamp(picasaPhoto); findFilename(service, picasaPhoto); }
void findBestContent(Picasa.Photo picasaPhoto) { string filename = picasaPhoto.Title; MimeType = picasaPhoto.PicasaEntry.Content.Type; HostedURL = picasaPhoto.PicasaEntry.Content.AbsoluteUri; foreach (MediaContent content in (picasaPhoto.AtomEntry as PicasaEntry).Media.Contents) { string contentType = content.Type; int contentWidth = 0; int contentHeight = 0; if (!int.TryParse(content.Width, out contentWidth)) { Log.Debug("GoogleContent: ", filename, ": Failed to parse int (width): ", content.Width); } if (!int.TryParse(content.Height, out contentHeight)) { Log.Debug("GoogleContent: ", filename, ": Failed to parse int (height): ", content.Height); } //Log.Debug ("GoogleContent: ", filename, ": Content: type=", contentType, ", size=", contentWidth, "x", contentHeight); if ((contentType.StartsWith("video") && !MimeType.StartsWith("video")) || (contentHeight > Dimensions.Height || contentWidth > Dimensions.Width)) { Dimensions = new PhotoDimensions { Width = contentWidth, Height = contentHeight }; MimeType = contentType; HostedURL = content.Url; } } //Log.Debug ("GoogleContent: ", filename, ": Best content: type=", MimeType, ", size=", Dimensions.Width, "x", Dimensions.Height); }