id
stringlengths
36
36
text
stringlengths
1
1.25M
66466be7-f0aa-4098-97c0-e4ffc32fa408
protected void setStatus(int status) { this.status = status; }
7ed11e7d-1381-45c4-8cb4-3b6bba9e9382
public User getUser() { return user; }
20e62486-ec6e-4af5-b055-992ff6c18d0b
protected void setUser(User user) { this.user = user; }
99fc9953-f837-41c7-8ae0-1f908ede1d12
public String getCamera() { return camera; }
b7ce8e56-63b5-45fb-83f0-f5e9ca2f31b4
protected void setCamera(String camera) { this.camera = camera; }
6da9e589-e055-4610-96c3-18e1025af049
public String getLens() { return lens; }
e48af7d3-284a-42eb-b550-1205dbeab8e1
protected void setLens(String lens) { this.lens = lens; }
d2a510d4-cb80-4d4e-a0a6-5f4c2815b1e7
public String getAperture() { return aperture; }
80a7d171-9446-4aac-84d9-ed1be73d762d
protected void setAperture(String aperture) { this.aperture = aperture; }
fb1c9452-a375-4dbf-9c08-c37e41663874
public String getFocalLength() { return focal_length; }
c1623220-681d-40f7-ac6e-436c086e90a7
protected void setFocal_length(String focal_length) { this.focal_length = focal_length; }
07f5c36a-be86-48fb-8012-968694669278
public String getIso() { return iso; }
9e59ffdc-1b1b-4241-a150-b8ee5d5fd2b5
protected void setIso(String iso) { this.iso = iso; }
7b8e5089-832b-4c70-9437-fda276fe2fe6
public String getShutterSpeed() { return shutter_speed; }
31fa9e88-6a11-4857-b34d-8ba5372dbb8d
protected void setShutter_speed(String shutter_speed) { this.shutter_speed = shutter_speed; }
5a7f5882-1ad3-4198-b7df-c8c519da055a
public Date getTakenDate() { return taken_at; }
cf48e75f-7619-454d-b192-b6ab928e057b
protected void setTaken_at(Date taken_at) { this.taken_at = taken_at; }
56c17e3c-15f9-4d8a-bb19-aa822d4c3be8
public String getLocation() { return location; }
503f8485-d2f5-4aa2-9546-8e41ab0c0605
protected void setLocation(String location) { this.location = location; }
f41f294c-88fb-440f-8c0c-54e2dbdc7c22
public double getLatitude() { return latitude; }
132cb77b-f4a7-44e4-acea-5f0c9ff7d8f6
protected void setLatitude(double latitude) { this.latitude = latitude; }
2fba0bdb-a7d7-4d19-a5c0-6b00444b2f2d
public double getLongitude() { return longitude; }
94efe7cd-fe63-49ac-8ddd-5136019f4733
protected void setLongitude(double longitude) { this.longitude = longitude; }
2b126ff3-3d9b-467f-b139-0865b48edd51
public BufferedImage getImage() { if (cachedImage == null) { BufferedImage rtn = null; try { rtn = ImageIO.read(new URL(image_url)); } catch (Exception e) { log.warn("Exception in Photo.getImage(" + image_url + ")",e); } cachedImage = rtn; } return cachedImage; }
e53cd6a0-7ed0-4ea3-83a6-1e7167d8ad0a
public int getTimesViewed() { return times_viewed; }
eb2e8d70-af41-49ef-bce5-63c195faabab
public void setTimesViewed(int views) { times_viewed = views; }
d017f5ff-119a-4cb1-b9d9-4206b38d5336
public boolean getNsfw() { return nsfw; }
cdc15e8c-8615-464b-aaff-309e808c7459
public void setNsfw(boolean nsfw) { this.nsfw = nsfw; }
e927ef4c-573e-4c58-ac5c-16b3ab026ebe
public boolean getVoted() { return voted; }
91ad6d01-f8f6-4d6a-9b33-0b89f2a2e4c2
public void setVoted(boolean voted) { this.voted = voted; }
5fd2f2b6-387d-4136-8af9-486636187e27
public boolean getFavorited() { return favorited; }
2c676074-8c70-4c3c-9caa-8b30e71be5a7
public void setFavorited(boolean favorited) { this.favorited = favorited; }
de2af7ea-b3d4-45bf-a6df-5feae91e517d
@Override public String toString() { return String .format("Photo [id=%s, name=%s, description=%s, category=%s, image_url=%s, votes_count=%s, favorites_count=%s, comments_count=%s, rating=%s, created_at=%s, status=%s, user=%s, camera=%s, lens=%s, aperture=%s, focal_length=%s, iso=%s, shutter_speed=%s, taken_at=%s, location=%s, latitude=%s, longitude=%s, cachedImage=%s, nsfw=%s]", id, name, description, category, image_url, votes_count, favorites_count, comments_count, rating, created_at, status, user, camera, lens, aperture, focal_length, iso, shutter_speed, taken_at, location, latitude, longitude, cachedImage, nsfw); }
58b8dcd6-2d5b-4592-8279-6d9cb3acfe49
public User getUser() { return user; }
3661dddb-dfe7-4ee5-82c7-2896b9b892ad
public void setUser(User user) { this.user = user; }
09030370-3086-480e-a99f-bc63a5f49f99
public Integer getCategory() { return category; }
4a555bc5-1d01-4a26-b8d5-6507433b356c
protected void setCategory(Integer category) { this.category = category; }
2dbf8065-1fda-404b-b050-c229dc0add89
public Integer getUser_id() { return user_id; }
563e8570-d26e-4145-8267-d44330e260f5
protected void setUser_id(Integer user_id) { this.user_id = user_id; }
212aa798-4c7d-442a-b65d-26db51f6198a
public ArrayList<Integer> getFriends_ids() { return friends_ids; }
46c16194-9c0f-4e7f-bec7-715364f3ac19
protected void setFriends_ids(ArrayList<Integer> friends_ids) { this.friends_ids = friends_ids; }
8811f927-dcd5-47a1-b5ac-f8fe84d68ebd
public Integer getExlcude() { return exlcude; }
eaf07408-b844-4910-a8c2-581b54d38b49
public void setExlcude(Integer exlcude) { this.exlcude = exlcude; }
cf664556-37e1-4e41-81b8-c3b7bc7f23a8
public String getFeature() { return feature; }
79972693-8fd3-4ba6-ba31-519f6e1ed6b3
protected void setFeature(String feature) { this.feature = feature; }
d26733b2-fcd9-41e7-a546-454c0133533f
public int getTotal_pages() { return total_pages; }
0128c613-d000-46ae-b5e7-2c7e458ec74e
protected void setTotal_pages(int total_pages) { this.total_pages = total_pages; }
949f4d4d-7741-4165-a875-0b2b5575cb2d
public ArrayList<Photo> getPhotos() { return photos; }
ff862e16-4d01-450d-b163-b764d9daf98b
protected void setPhotos(ArrayList<Photo> photos) { this.photos = photos; }
9c259bc0-7779-4e1f-903b-c9d0f5cbe83b
public int getCurrent_page() { return current_page; }
065f7ce6-9c8d-448e-b85b-42708415de78
protected void setCurrent_page(int current_page) { this.current_page = current_page; }
38341362-4655-4079-a348-200fa87fef26
public int getTotal_items() { return total_items; }
71f7d58f-79e0-4a35-bbb2-f423bcdd3ab0
protected void setTotal_items(int total_items) { this.total_items = total_items; }
73e8796d-0ce8-4330-94ed-d5a44747d9d9
public Filters getFilters() { return filters; }
faaed131-d39a-43a6-96a8-c7e58042969f
protected void setFilters(Filters filters) { this.filters = filters; }
799d9383-ee17-4711-b389-1f7591b882bc
public void setBuilder(Api500pxStreamBuilder builder) { this.builder = builder; }
f796eb6a-f457-4d88-bdd6-2ff3496627fb
public Api500pxStreamBuilder getBuilder() { return builder; }
b6240969-4fc0-4cc6-83a9-32f2a30dca8b
public FeatureResponse getNextPage() { if (current_page == total_pages) { return null; } else { return builder.page(current_page + 1).getResponse(); } }
e606dfbf-4ae1-4ea9-8f6c-213a487c5218
public FeatureResponse getAllPhotos() { int page = current_page; FeatureResponse tempFr; while (page++ < total_pages) { tempFr = builder.page(page).getResponse(); if (tempFr != null) { for (Photo p : tempFr.getPhotos()) { photos.add(p); } } } total_pages = 1; // can't really iterate anymore so set the total_pages to be 1 return this; }
45f2774c-4836-4fc5-8404-d2e0f425feb9
ImageSize(int key) { sizeKey = key; }
5a3d8691-2cd9-4644-b9bd-55f549bf3099
public int getSizeKey() { return sizeKey; }
5ad55eea-16af-4fdb-a07e-dd5c81a706c9
public Api500pxPhotoUrlBuilder() { }
be22a2c2-9c64-4d21-893a-a6696079cb54
public Api500pxPhotoUrlBuilder(int imageId, String consumerKey) { this.imageId = imageId; this.consumerKey = consumerKey; }
eb6f7bb3-fa96-4e0b-883f-8792aead7983
public Api500pxPhotoUrlBuilder withConsumerKey(String consumerKey) { this.consumerKey = consumerKey; return this; }
90b1681b-6cdf-422b-9f04-0c7c8c8a7c87
public Api500pxPhotoUrlBuilder forImageId(int imageId) { this.imageId = imageId; return this; }
fd0f4763-a16d-4d85-91af-cd3bb50a87e2
public Api500pxPhotoUrlBuilder smallThumbnail() { imageSize = ImageSize.SmallThumbnail.getSizeKey(); return this; }
edab5f2a-e449-47b2-95db-af02d603e33d
public Api500pxPhotoUrlBuilder mediumThumbnail() { imageSize = ImageSize.MediumThumbnail.getSizeKey(); return this; }
401f4c2d-67c0-4cc9-8fc2-ec7a0f244ed3
public Api500pxPhotoUrlBuilder largeThumbnail() { imageSize = ImageSize.LargeThumbnail.getSizeKey(); return this; }
e863a933-0960-4fd9-84c8-bc5817ee6683
public Api500pxPhotoUrlBuilder fullImage() { imageSize = ImageSize.Image.getSizeKey(); return this; }
e0a3984a-0bab-4e47-9904-360bddc7ca7f
public Api500pxPhotoUrlBuilder commentsPage(int page) { if (page > 0) { this.includeComments = true; this.commentsPage = page; } return this; }
9347ca30-0985-40e3-b2f8-69c7527c5560
private String urlString() { StringBuilder bldr = new StringBuilder(128); String baseUrl = String.format(PHOTO_RESOURCE_URL, imageId, consumerKey); bldr.append(baseUrl); if (imageSize != null) { bldr.append("&image_size="); bldr.append(imageSize); } if (includeComments) { bldr.append("&comments=1"); if (commentsPage != null) { bldr.append("&comments_page="); bldr.append(commentsPage); } } //System.out.println(bldr.toString()); return bldr.toString(); }
e02da59e-cb72-484f-970e-73d659ac176e
public PhotoResponse getResponse() { PhotoResponse pr = null; try { OAuthService service = null; if (privateKey != null && accessToken != null) { service = new ServiceBuilder().provider(Px500Api.class).apiKey(consumerKey).apiSecret(privateKey).build(); } OAuthRequest request = new OAuthRequest(Verb.GET, urlString()); if (service != null) { service.signRequest(accessToken, request); } Response response = null; int tries = 0; while (response == null && tries < MAX_RESPONSE_TRIES) { try { tries++; response = request.send(); } catch (OAuthConnectionException oce) { if (tries < MAX_RESPONSE_TRIES) { // some sort of error happened log.debug("Exception getting response on try " + tries); Thread.sleep((2 ^ (tries - 1)) * RETRY_DELAY); } else { log.warn("Couldn't get response after " + tries + " attempts.", oce); } } } if (response != null) { String body = response.getBody(); log.trace(body); Gson gson = GsonFactory.getGson(); // // TODO better way to check for html return // //if (body.contains("<html") || body.contains("<!DOCTYPE")) if (body.contains("<!DOCTYPE")) { log.warn("Response body: " + System.lineSeparator() + body); } else { pr = gson.fromJson(body, PhotoResponse.class); } } } catch (Exception badE) { // TODO: log this, turn it into another exception type log.warn("Exception getting response", badE); } return pr; }
ad99e245-4ae5-4836-8ab3-e05e6a9453be
public Api500pxStreamBuilder(String consumerKey) { this(consumerKey, null); }
d17bcda6-8d96-4bef-80f1-be3d5595fcc3
public Api500pxStreamBuilder(String consumerKey, String privateKey) { this.consumerKey = consumerKey; this.privateKey = privateKey; baseUrl = String.format(PHOTOS_URL_BASE, consumerKey); }
c6bbdb66-be6c-47ef-8bfa-95c20dbda782
public Api500pxStreamBuilder popularPhotos() { feature = "popular"; return this; }
1699a266-698e-44a7-815a-de69122d59dd
public Api500pxStreamBuilder upcomingPhotos() { feature = "upcoming"; return this; }
313cdf7e-bea5-4fc9-b236-9fd7b3b42630
public Api500pxStreamBuilder editorsPhotos() { feature = "editors"; return this; }
88dc61d6-223f-4a5b-a784-7d1b8c193b56
public Api500pxStreamBuilder freshTodayPhotos() { feature = "fresh_today"; return this; }
2dd316e9-fd16-4b05-a10f-6f1e2bfc94c3
public Api500pxStreamBuilder freshYesterdayPhotos() { feature = "fresh_yesterday"; return this; }
e1cf2d46-64f9-4bfd-b364-591422ac7229
public Api500pxStreamBuilder freshThisWeekPhotos() { feature = "fresh_week"; return this; }
fa4bca5b-c73b-45f3-8042-ff7ccbbcc086
public Api500pxStreamBuilder userPhotos(String username) { feature = "user"; this.username = username; return this; }
183c1758-e7bb-4c56-b1b9-3d46fb52bda8
public Api500pxStreamBuilder userPhotos(Integer user_id) { feature = "user"; this.user_id = user_id; return this; }
5f8493ae-fc3d-4814-828a-0d3413493933
public Api500pxStreamBuilder userFriendsPhotos(String username) { feature = "user_friends"; this.username = username; return this; }
822b1227-fc0d-4e21-8661-816fb4d73aa2
public Api500pxStreamBuilder userFriendsPhotos(Integer user_id) { feature = "user_friends"; this.user_id = user_id; return this; }
1a164630-1485-4e27-96cb-3a4775233844
public Api500pxStreamBuilder userFavoritesPhotos(String username) { feature = "user_favorites"; this.username = username; return this; }
1a39522d-1fcd-4c39-8d0d-787268ce22e6
public Api500pxStreamBuilder userFavoritesPhotos(Integer user_id) { feature = "user_favorites"; this.user_id = user_id; return this; }
0dbfcdcc-c080-4a96-98b9-84f4381cb800
public Api500pxStreamBuilder only(Category cat) { onlyCategory = cat; return this; }
c62b8b32-fecc-4a89-877e-fc247384466e
public Api500pxStreamBuilder exclude(Category cat) { excludeCategory = cat; return this; }
6692304e-d551-4ea9-a499-c6d6f58bcf1a
public Api500pxStreamBuilder smallThumbnails() { imageSize = ImageSize.SmallThumbnail.getSizeKey(); return this; }
4c3925ef-e8be-44f9-9508-eb9b94a2deb7
public Api500pxStreamBuilder mediumThumbnails() { imageSize = ImageSize.MediumThumbnail.getSizeKey(); return this; }
c4df561e-f705-4f5c-9afe-97724bb305bb
public Api500pxStreamBuilder largeThumbnails() { imageSize = ImageSize.LargeThumbnail.getSizeKey(); return this; }
aa9dbca0-2e1a-4aa5-bc0d-d7084e7a8a96
public Api500pxStreamBuilder fullImage() { imageSize = ImageSize.Image.getSizeKey(); return this; }
5d8ff953-0d1f-46ff-8b85-ecfda5735335
public Api500pxStreamBuilder page(int page) { if (page > 0) { this.page = page; } return this; }
068f63b2-c8b0-45d3-a01c-43452bf4951b
public Api500pxStreamBuilder resultsPerPage(int rpp) { if (rpp > 0 && rpp < 101) { this.rpp = rpp; } return this; }
60c0dfeb-e409-4be9-a26e-a9696a36e57f
public Api500pxStreamBuilder accessToken(Token accessToken) { this.accessToken = accessToken; return this; }
59164292-1030-4444-bbde-2baec5d77ec4
public Api500pxStreamBuilder sort(Sort sortOrder) { this.sortOrder = sortOrder; return this; }
57108e2c-0d34-4f16-941f-a1e6e554807f
public Api500pxStreamBuilder ascending() { this.sortDirection = "asc"; return this; }
7671c390-b6bb-4654-b8bd-3daf046a2429
public Api500pxStreamBuilder decending() { this.sortDirection = "desc"; return this; }
a7f705e5-217b-4f3f-8548-c922759dafa5
public Api500pxStreamBuilder withStore() { this.store = true; return this; }
11845db9-b4e6-4885-9bfe-8231d016b81a
public Api500pxStreamBuilder withStates() { this.states = true; return this; }