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.

沒有留言:

張貼留言

乩童警探 一二集

接連看了兩集。第一集還算新鮮,到了第二集就看得比較慢了。一來,劇情雖然常會提到乩童,但真的跟乩童又沒有什麼關係。第二集後半大概就猜出是怎麼一回事了,但還是很享受在作者解釋的過程。只是前面舖陳有點久,而且人物有點多,再加上我是斷斷續續的看,看到後來都快忘了誰是誰,或是誰曾經出過什麼...