2008/06/05

le chat qui voit / improvement of FlickrRandomImage

p4050108
Olympus E300
Taipei, Taiwan
20060405

旁觀者

****

Originally, FlickrRandomImage only shows 10 images from a random page of my flickr account. I found that it's not so interesting. I want the results to be more various; in other words, I want to have 10 images individually from different pages, instead of from the same page.

In order to make this modification, at first I have to know the total amount of my photos on flickr. I can get a Person object by calling the following API:

Flickr.PeopleGetInfo(userid);

and then, with the Person object, I can access PhotosSummary object in which there's an attribute -- PhotoCount.

Now, I can create a PhotoSearchOptions object with PerPage = 1 and Page = a_random_number_genereted_between_1_and_photoAmount

Do a for loop for 10 times. That's it! Quite Simple, n'est-ce pas?

Somehow, I found the performance is quite slow. Anyways, it works now. I will find another day to fix the performance issue.

ps. With my new modification, I found this cute cat.

No comments:

Post a Comment

騎士團長殺人事件 --村上春樹

今年的日文小說看完了。篇幅很長,但規模不大,故事都繞著幾個主要的人物。情節裡有些超現實的場景,但最後卻讓人有點意猶未盡,因為有些想搞懂的疑點,在還沒講清之前就結束了。