本文整理汇总了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;
//.........这里部分代码省略.........
示例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;
}
示例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;
}
示例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");
}
}
}