当前位置: 首页>>代码示例>>C#>>正文


C# Flickr.PhotosetsGetPhotos方法代码示例

本文整理汇总了C#中FlickrNet.Flickr.PhotosetsGetPhotos方法的典型用法代码示例。如果您正苦于以下问题:C# Flickr.PhotosetsGetPhotos方法的具体用法?C# Flickr.PhotosetsGetPhotos怎么用?C# Flickr.PhotosetsGetPhotos使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FlickrNet.Flickr的用法示例。


在下文中一共展示了Flickr.PhotosetsGetPhotos方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

        static void Main(string[] args)
        {
            Flickr flickr = new Flickr(FlickrKey.Key, FlickrKey.Secret);
            Auth auth = null;
            if (File.Exists("key.txt"))
            {
                using (var sr = new StreamReader("key.txt"))
                {
                    flickr.OAuthAccessToken = sr.ReadLine();
                    flickr.OAuthAccessTokenSecret = sr.ReadLine();
                }

            }

            if (!string.IsNullOrEmpty(flickr.OAuthAccessToken) &&
                 !string.IsNullOrEmpty(flickr.OAuthAccessTokenSecret))
            {
                auth = flickr.AuthOAuthCheckToken();
                int g = 56;
            }
            else
            {
                var requestToken = flickr.OAuthGetRequestToken("oob");
                var url = flickr.OAuthCalculateAuthorizationUrl(requestToken.Token, AuthLevel.Delete);
                Process.Start(url);

                var verifier = Console.ReadLine();

                OAuthAccessToken accessToken = flickr.OAuthGetAccessToken(requestToken, verifier);
                flickr.OAuthAccessToken = accessToken.Token;
                flickr.OAuthAccessTokenSecret = accessToken.TokenSecret;

                using (var sw = new StreamWriter("key.txt", false))
                {
                    sw.WriteLine(flickr.OAuthAccessToken);
                    sw.WriteLine(flickr.OAuthAccessTokenSecret);
                }

                auth = flickr.AuthOAuthCheckToken();
                int y = 56;
            }

            var baseFolder = @"D:\MyData\Camera Dumps\";

            var ex = new PhotoSearchExtras();
            var p = flickr.PhotosSearch(new PhotoSearchOptions(auth.User.UserId){Extras = PhotoSearchExtras.DateTaken | PhotoSearchExtras.PathAlias, });
            var sets = flickr.PhotosetsGetList();
            foreach (var set in sets)
            {
                var setDir = Path.Combine(baseFolder, set.Title);
                if ( Directory.Exists(setDir) )
                {
                    var setPhotos = flickr.PhotosetsGetPhotos(set.PhotosetId, PhotoSearchExtras.DateTaken | PhotoSearchExtras.MachineTags | PhotoSearchExtras.OriginalFormat | PhotoSearchExtras.DateUploaded);
                    foreach(var setPhoto in setPhotos)
                    {
                        if (Math.Abs((setPhoto.DateUploaded - setPhoto.DateTaken).TotalSeconds) < 60)
                        {
                            // Suspicious
                            int s = 56;
                        }

                        string ext = ".jpg";
                        if (setPhoto.OriginalFormat != "jpg")
                        {
                            int xxx = 56;
                        }
                        var filePath = Path.Combine(setDir, setPhoto.Title + ext);

                        if (!File.Exists(filePath))
                        {
                            // try mov
                            filePath = Path.Combine(setDir, setPhoto.Title + ".mov");

                            if (!File.Exists(filePath))
                            {
                                Console.WriteLine("not found " + filePath);
                            }
                        }

                        Console.WriteLine(filePath);
                        if ( File.Exists(filePath))
                        {
                            DateTime dateTaken;
                            if (!GetExifDateTaken(filePath, out dateTaken))
                            {
                                var fi = new FileInfo(filePath);
                                dateTaken = fi.LastWriteTime;
                            }

                            if (Math.Abs((dateTaken - setPhoto.DateTaken).TotalSeconds) > 10)
                            {
                                int hmmm = 56;
                            }
                        }
                    }
                }
            }
            //@"D:\MyData\Camera Dumps\"

            int z =  56;
//.........这里部分代码省略.........
开发者ID:jjbott,项目名称:SyncTool,代码行数:101,代码来源:Program.cs

示例2: GetPagedSet

        public static PhotosetPhotoCollection GetPagedSet(string setId, int maximumRows, int startRowIndex)
        {
            Flickr flickr = new Flickr(ConfigurationManager.AppSettings["apiKey"],
                ConfigurationManager.AppSettings["sharedSecret"]);
            PhotosetPhotoCollection photos = flickr.PhotosetsGetPhotos(setId, GetPageIndex(
                startRowIndex, maximumRows) + 1, maximumRows);

            return photos;
        }
开发者ID:holdenben,项目名称:photoStarter,代码行数:9,代码来源:FlickrBLL.cs

示例3: GetPhotosetPhotos

        private PhotosetPhotoCollection GetPhotosetPhotos(string photosetID, Flickr flickr, int page, int perPage)
        {
            PhotosetPhotoCollection photos = new PhotosetPhotoCollection();

            PhotoSearchOptions options = GetPhotoSearchOptions();

            Flickr.CacheDisabled = true;

            photos = flickr.PhotosetsGetPhotos(photosetID, page, perPage);

            return photos;
        }
开发者ID:lauraemilyjacobsen,项目名称:HikeBlog,代码行数:12,代码来源:PhotoController.cs

示例4: SimpleSearchButton1_Click

        private void SimpleSearchButton1_Click(object sender, EventArgs e)
        {
            OutputTextbox.Text = "";

            // Example 1
            //string apikey = ApiKey.Text;
            string apikey ="deaba23a63d9b3c34b63f1a04548a3f4";
            Flickr flickr = new Flickr(apikey);

            // Example 2
            PhotoSearchOptions searchOptions = new PhotoSearchOptions();
            searchOptions.UserId = "[email protected]";
            //searchOptions.Tags = "kanas";
            searchOptions.PerPage = 500;
            PhotoCollection microsoftPhotos = flickr.PhotosSearch(searchOptions);
            PhotosetPhotoCollection myset = flickr.PhotosetsGetPhotos("72157636689533194");
            //PhotoCollection myset = flickr.PhotosSearch(searchOptions);
            //Photoset myset = flickr.PhotosetsGetInfo("72157594398087814");

            // Example 3
            //searchOptions.Page = 2;
            //PhotoCollection microsoftPhotos2 = flickr.PhotosSearch(searchOptions);
            //searchOptions.Page = 3;
            //PhotoCollection microsoftPhotos3 = flickr.PhotosSearch(searchOptions);

            // Eample 4
            List<Photo> allPhotos = new List<Photo>();
            allPhotos.AddRange(myset);
            //allPhotos.AddRange(microsoftPhotos2);
            //allPhotos.AddRange(microsoftPhotos3);

            WebClient webClient = new WebClient();

            String s = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);
            foreach (Photo photo in allPhotos)
            {

                OutputTextbox.Text += "Photos title is " + photo.Title + " " + photo.ThumbnailUrl+ "\r\n";

                if (photo.DoesLargeExist){
                    webClient.DownloadFile(photo.LargeUrl, s + @"\ssr\" + photo.PhotoId +searchOptions.Tags+ @".jpg");
                }
                else if(photo.DoesMediumExist){
                    webClient.DownloadFile(photo.MediumUrl, [email protected]"\ssr\"[email protected]".jpg");

                }
                //else if (photo.OriginalUrl)
                //{
                    //webClient.DownloadFile(photo.MediumUrl, s + @"\temp\" + photo.PhotoId + searchOptions.Tags + @".jpg");

                //}
                else
                {
                    webClient.DownloadFile(photo.Medium640Url , s + @"\ssr\" + photo.PhotoId + [email protected]".jpg");

                }

            }
        }
开发者ID:kenpower,项目名称:flickdownloader,代码行数:59,代码来源:ExampleForm1.cs


注:本文中的FlickrNet.Flickr.PhotosetsGetPhotos方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。