A set of properties for the photoset.
Inheritance: IFlickrParsable
 public GalleryViewModel(Photoset set, IPagedList<FlickrNet.Photo> collection, int post, string id)
 {
     this.Photoset = set;
     this.Photos = collection;
     this.PostID = post;
     this.PhotosetID = id;
 }
        public void AddPhotoToSet(AImg img,Photoset set)
        {
            _log.InfoFormat("adding {0} to photoset : {1}",img.FileFullPath,set.PhotosetId);

            try
            {
                Stopwatch stopWatch = Stopwatch.StartNew();
                _flickr.PhotosetsAddPhoto(set.PhotosetId, img.FlickrPhotoId);
                stopWatch.Stop();
                _log.DebugFormat("Add to Set success. Took:{0}s.", stopWatch.Elapsed.TotalSeconds);
                img.UpdatePhotosetId(set.PhotosetId, DateTime.Now, stopWatch.Elapsed.TotalSeconds);
            }
            catch (FlickrApiException ex)
            {
                if (ex.Code == 3) //photo already exists.
                {
                    //DONT consider this as failure
                    img.UpdatePhotosetId(set.PhotosetId, DateTime.Now, 0);
                }
                else
                {
                    img.AddToSetEx = ex;
                    _log.Error(string.Format("Failed to add {0} to photoset : {1}", img.FileFullPath, set.Title), ex);
                }
            }
            catch (Exception ex)
            {
                img.AddToSetEx = ex;
                _log.Error(string.Format("Failed to add {0} to photoset : {1}", img.FileFullPath, set.Title), ex);
            }
        }
        public ActionResult Gallery(string id, int postID, int? page)
        {
            IPagedList<Photo> photos = null;
            Photoset set = new Photoset();

            int pageNumber = (page ?? 1);

            if (id != null)
            {
                Flickr flickr = new Flickr(flickrKey, sharedSecret);
                photos = GetPhotosetPhotos(id, flickr).ToPagedList<Photo>(pageNumber, 30);
                set = flickr.PhotosetsGetInfo(id);
            }

            GalleryViewModel vm = new GalleryViewModel(set, photos, postID, id);
            return View(vm);
        }
Example #4
0
    private void SyncNewAlbumsToServer()
    {
        ArrayList albums = PersistentInformation.GetInstance().GetNewAlbums();

        Gtk.Application.Invoke(delegate {
            DeskFlickrUI.GetInstance().SetStatusLabel("Creating sets on server...");
            DeskFlickrUI.GetInstance().SetProgressBarText("");
            DeskFlickrUI.GetInstance().SetLimitsProgressBar(albums.Count);
        });
        foreach (Album album in albums)
        {
            Gtk.Application.Invoke(delegate {
                DeskFlickrUI.GetInstance().SetStatusLabel(
                    "Creating sets on server... " + album.Title);
            });
            DelegateIncrementProgressBar();
            FlickrNet.Photoset photoset = SafelyCreateNewAlbum(album);
            if (photoset == null)
            {
                continue;
            }
            ArrayList photoids = PersistentInformation.GetInstance()
                                 .GetPhotoIdsForAlbum(album.SetId);
            // Remove the old fake album entry.
            PersistentInformation.GetInstance().DeleteAlbum(album.SetId);
            PersistentInformation.GetInstance().DeleteAllPhotosFromAlbum(album.SetId);
            // Create and add a new one.
            Album newalbum = new Album(photoset.PhotosetId, album.Title,
                                       album.Desc, album.PrimaryPhotoid);
            PersistentInformation.GetInstance().InsertAlbum(newalbum);
            // Set the album dirty, in case the photosetseditphotos operation
            // fails, in this round of updates. Then, we'll retry the updates
            // next time, without they being overridden.
            PersistentInformation.GetInstance().SetAlbumDirty(newalbum.SetId, true);
            foreach (string photoid in photoids)
            {
                PersistentInformation.GetInstance().AddPhotoToAlbum(photoid, newalbum.SetId);
            }
            // Add the photos to the new album.
            flickrObj.PhotosetsEditPhotos(newalbum.SetId, newalbum.PrimaryPhotoid,
                                          Utils.GetDelimitedString(photoids, ","));
            PersistentInformation.GetInstance().SetAlbumDirty(newalbum.SetId, false);
        }
    }
Example #5
0
 internal static string UrlFormat(Photoset p, string size, string extension)
 {
     return UrlFormat(p.Farm, p.Server, p.PrimaryPhotoId, p.Secret, size, extension);
 }
Example #6
0
 internal static string UrlFormat(Photoset p, string size, string extension)
 {
     return(UrlFormat(p.Farm, p.Server, p.PrimaryPhotoId, p.Secret, size, extension));
 }
Example #7
0
 public Album Convert(Photoset set)
 {
     return new Album(set.OwnerId, set.PhotosetId, set.Title, set.PhotosetSmallUrl);
 }
		internal static string UrlFormat(Photoset p, string size, string format)
		{
			return UrlFormat(photoUrl, p.Farm, p.Server, p.PrimaryPhotoId, p.Secret, size, format);
		}
Example #9
0
 internal static string UrlFormat(Photoset p, string size, string format)
 {
     return(UrlFormat(photoUrl, p.Farm, p.Server, p.PrimaryPhotoId, p.Secret, size, format));
 }
        private bool Exists(string photosetname,ref Photoset set)
        {
            Refresh();

               set = _collection.FirstOrDefault(x => x.Title.ToLower() == photosetname.ToLower());

               _log.InfoFormat("this folder {0} {1} exists as set.", photosetname, set != null ? "" : "DOES NOT");

            return set != null;
        }
Example #11
0
 public Image PhotosetThumbnail(Photoset ps)
 {
     try
     {
         return Bitmap.FromStream(f.DownloadPicture(ps.PhotosetSquareThumbnailUrl));
     }
     catch (Exception)
     {
         return Properties.Resources.icon_replace;
     }
 }