private FlickrPhoto buildInfo(JsonReader jsonReader) { JsonObject jobj = jsonReader.readObject(); JsonObject object = (JsonObject) jobj.get("photo"); String id = object.getString("id"); FlickrPhoto p = photos.getPhoto(id); if (p == null) { p = new FlickrPhoto(); p.id = id; photos.setPhoto(p); } p.id = id; // JsonArray array = (JsonArray) object.get("dates"); object = (JsonObject) object.get("dates"); logger.debug("date=" + object.getString("taken")); logger.debug( "dateTaken=" + FlickrPhotoDate.setDateInFlickrTextFormat(object.getString("taken"))); p.dateTaken = FlickrPhotoDate.setDateInFlickrTextFormat(object.getString("taken")); logger.debug("DateTaken=" + p.dateTaken); return p; }
/** * Get a the appropriate Token for a given URL * * @param text the anchor text * @param url the url */ public static Token tokenForUrl(String url, String text) { if (url == null) { return null; } // Look for video links Video video = Video.matchURL(url, text); if (video != null) { return video; } // Look for video links. YouTubeVideo ytVideo = YouTubeVideo.matchURL(url, text); if (ytVideo != null) { return ytVideo; } // Look for photo links. Photo photo = Photo.matchURL(url, text); if (photo != null) { return photo; } // Look for photo links. FlickrPhoto flickrPhoto = FlickrPhoto.matchURL(url, text); if (flickrPhoto != null) { return flickrPhoto; } // Not media, so must be a regular URL return new Link(url, text); }