public GoogleAlbum(GooglePhotosService service, AlbumsQuery albumsQuery, string name) : base(name) { this.service = service; this.albumsQuery = albumsQuery; Directory = null; picasaAlbums = albumsQuery.ByDecodedName(decodedName: Name); }
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 findFilename(GooglePhotosService service, Picasa.Photo picasaPhoto) { string filename = picasaPhoto.Title; // the file name has to be platform independent filename = filename.Replace(":", "_").Trim('_', '.', ' ', '~'); // the file ending has to be in lower case filename = System.IO.Path.GetFileNameWithoutExtension(filename) + System.IO.Path.GetExtension(filename).ToLower(); string betterFilename = filename; string username = service.Auth.Account.ShortDisplayName; if (filename == "MOVIE.m4v") { betterFilename = "MOVIE_" + GoogleTimestamp.ToString("yyyyMMdd_HHmmss") + ".m4v"; } if (!FilenameUtilities.IsPreferredFileName(betterFilename)) { DateTime preferredDate; // get the date from the filename or use google's timestamp DateTime date; if (FilenameUtilities.GetFileNameDate(fileName: betterFilename, date: out date) && DateTimeExtensions.HasTimeComponent(date)) { preferredDate = date; } else { preferredDate = GoogleTimestamp; } betterFilename = FilenameUtilities.MakePreferredFileName(fileName: betterFilename, date: preferredDate, author: username); } if (FilenameUtilities.HasNoFileEnding(fullPath: betterFilename)) { string mimeType = picasaPhoto.PicasaEntry.Content.Type; string fileEnding = MimeTypes.ExtensionFromMimeType(mimeType: mimeType); // determine the best file ending if (fileEnding != null) { // rename the file filename += fileEnding; betterFilename += fileEnding; //Log.Debug ("Filename with ending: ", betterFilename); } } betterFilename = regexIllegalCharacters.Replace(betterFilename, ""); BestFilename = betterFilename; AlternateFilename = filename; //Log.Debug ("Filename for download: ", BestFilename); }
public static string VirtualDirectoryName(GooglePhotosService service) { return(service.Auth.Account.Emails); }
public GoogleShare(GooglePhotosService service) { this.service = service; }