private void UploadFiles(DirectoryInfo directory, Album onlineAlbum) { var files = directory.GetFiles(); var photosInOnlineAlbum = manager.GetPhotos(onlineAlbum); var allowedTypes = config.PhotoTypes.Split(' ', ',', ';').Select(x => x.ToLower()); foreach (var file in files) { if (allowedTypes.Contains(file.Extension.Trim('.').ToLower())) { string path = file.FullName; var fileName = System.IO.Path.GetFileNameWithoutExtension(path); var onlinePhoto = photosInOnlineAlbum.SingleOrDefault(x => x.Title == fileName); if (onlinePhoto == null) { WriteVerbose($"Pushing {file.FullName} to album {onlineAlbum.Name}"); FlickrPhotoId onlinePhotoId = commonOperations.AddPhotoToAlbumId(file.FullName, onlineAlbum); } else { WriteVerbose($"Photo {fileName} already exists in {onlineAlbum.Name}"); } } else { WriteVerbose($"Not supported type {file.Extension}"); } } }
public Album CreateAlbum(string albumName, FlickrPhotoId coverPhotoId) { var photoset = Flickr.PhotosetsCreate(albumName, coverPhotoId.Id); Album result = Album.CreateAlbum(photoset); return(result); }
private void UploadPrimaryPhotoIfExists(DirectoryInfo directory, Album onlineAlbum) { var files = directory.GetFiles(); var localPrimaryPhotos = files.Where(x => Path.GetFileNameWithoutExtension(x.FullName).EndsWith(Cover)); var localPrimaryPhoto = localPrimaryPhotos.SingleOrDefault(); if (onlineAlbum.PrimaryPhotoId.Id == null && localPrimaryPhoto != null) { //updload local photo, cover will be set automatically as this is first photo FlickrPhotoId onlinePhotoId = commonOperations.AddPhotoToAlbumId(localPrimaryPhotos.Single().FullName, onlineAlbum); } }
//public PSPhoto PrimaryPhoto { get; set; } public Album(AlbumId albumId, string name, FlickrPhotoId primaryPhotoId) { this.AlbumId = albumId; this.Name = name; this.PrimaryPhotoId = primaryPhotoId; }
private FlickrPhoto PrimaryPhoto(List <FlickrPhoto> photos, FlickrPhotoId primaryPhotoId) { var primaryPhoto = photos.SingleOrDefault(x => x.PhotoId == primaryPhotoId); return(primaryPhoto); }
public FlickrPhoto(FlickrPhotoId photoId, string title) { this.PhotoId = photoId; this.Title = title; }
public void RemovePhotoFromAlbum(FlickrPhotoId photoId, Album albumId) { Flickr.PhotosetsRemovePhoto(albumId.AlbumId.Id, photoId.Id); }
public void AddPhotoToAlbum(Album album, FlickrPhotoId photoId) { Flickr.PhotosetsAddPhoto(album.AlbumId.Id, photoId.Id); }
public void SetCoverPhoto(Album albumId, FlickrPhotoId photoId) { Flickr.PhotosetsSetPrimaryPhoto(albumId.AlbumId.Id, photoId.Id); }