-
Notifications
You must be signed in to change notification settings - Fork 1
/
FlickrFeeder.pde
53 lines (44 loc) · 1.31 KB
/
FlickrFeeder.pde
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
class FlickrFeeder
{
private ArrayList tagged;
private ArrayList untagged;
public FlickrFeeder(String secret, String collection, String[] tags)
{
tagged = new ArrayList();
untagged = new ArrayList();
String page = "2";
String baseURL = "https://api.flickr.com/services/rest/?method=flickr.people.getPublicPhotos&api_key=" + secret + "&user_id=" + collection + "&extras=tags&safe_search=1&per_page=500&page=" + page + "&format=json&nojsoncallback=1";
JSONObject jsonResponse = loadJSONObject(baseURL);
JSONArray picturesCollection = jsonResponse.getJSONObject("photos").getJSONArray("photo");
for (int i = 0; i < picturesCollection.size(); i++) {
JSONObject json = picturesCollection.getJSONObject(i);
FlickrPhoto picture = new FlickrPhoto(json, false);
int j = 0;
for (j = 0; j < tags.length; j++) {
if (picture.tags != null && picture.tags.indexOf(tags[j]) != -1) {
tagged.add(picture);
break;
}
}
if (j == tags.length) {
untagged.add(picture);
}
}
}
public boolean available()
{
return false;
}
public boolean taggedAvailable()
{
return false;
}
public FlickrPhoto getTagged()
{
return null;
}
public FlickrPhoto getUntagged()
{
return null;
}
}