• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java PhotoEntry类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中com.google.gdata.data.photos.PhotoEntry的典型用法代码示例。如果您正苦于以下问题:Java PhotoEntry类的具体用法?Java PhotoEntry怎么用?Java PhotoEntry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

PhotoEntry类属于com.google.gdata.data.photos包,在下文中一共展示了PhotoEntry类的25个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: createPhoto

点赞 3

import com.google.gdata.data.photos.PhotoEntry; //导入依赖的package包/类
private void createPhoto(AlbumEntry albumEntry) throws Exception {
  PhotoEntry photo = new PhotoEntry();

  String title = getString("Title");
  photo.setTitle(new PlainTextConstruct(title));
  String description = getString("Description");
  photo.setDescription(new PlainTextConstruct(description));
  photo.setTimestamp(new Date());

  OtherContent content = new OtherContent();


  File file = null;
  while (file == null || !file.canRead()) {
    file = new File(getString("Photo location"));
  }
  content.setBytes(getBytes(file));
  content.setMimeType(new ContentType("image/jpeg"));
  photo.setContent(content);

  insert(albumEntry, photo);
}
 

开发者ID:google,
项目名称:gdata-java-client,
代码行数:23,
代码来源:PicasawebCommandLine.java

示例2: getPhotos

点赞 3

import com.google.gdata.data.photos.PhotoEntry; //导入依赖的package包/类
/**
 * Retrieves the photos for the given album.
 */
public List<PhotoEntry> getPhotos(AlbumEntry album) throws IOException,
    ServiceException {

  String feedHref = getLinkByRel(album.getLinks(), Link.Rel.FEED);
  AlbumFeed albumFeed = getFeed(feedHref, AlbumFeed.class);

  List<GphotoEntry> entries = albumFeed.getEntries();
  List<PhotoEntry> photos = new ArrayList<PhotoEntry>();
  for (GphotoEntry entry : entries) {
    GphotoEntry adapted = entry.getAdaptedEntry();
    if (adapted instanceof PhotoEntry) {
      photos.add((PhotoEntry) adapted);
    }
  }
  return photos;
}
 

开发者ID:google,
项目名称:gdata-java-client,
代码行数:20,
代码来源:PicasawebClient.java

示例3: getComments

点赞 3

import com.google.gdata.data.photos.PhotoEntry; //导入依赖的package包/类
/**
 * Retrieves the comments for the given photo.
 */
public List<CommentEntry> getComments(PhotoEntry photo) throws IOException,
    ServiceException {

  String feedHref = getLinkByRel(photo.getLinks(), Link.Rel.FEED);
  AlbumFeed albumFeed = getFeed(feedHref, AlbumFeed.class);

  List<GphotoEntry> entries = albumFeed.getEntries();
  List<CommentEntry> comments = new ArrayList<CommentEntry>();
  for (GphotoEntry entry : entries) {
    GphotoEntry adapted = entry.getAdaptedEntry();
    if (adapted instanceof CommentEntry) {
      comments.add((CommentEntry) adapted);
    }
  }
  return comments;
}
 

开发者ID:google,
项目名称:gdata-java-client,
代码行数:20,
代码来源:PicasawebClient.java

示例4: getComments

点赞 3

import com.google.gdata.data.photos.PhotoEntry; //导入依赖的package包/类
/**
 * Retrieves the comments for the given photo.
 */
public List<CommentEntry> getComments(PhotoEntry photo) throws IOException,
        ServiceException {

    String feedHref = getLinkByRel(photo.getLinks(), Link.Rel.FEED);
    AlbumFeed albumFeed = getFeed(feedHref, AlbumFeed.class);

    List<GphotoEntry> entries = albumFeed.getEntries();
    List<CommentEntry> comments = new ArrayList<CommentEntry>();
    for (GphotoEntry entry : entries) {
        GphotoEntry adapted = entry.getAdaptedEntry();
        if (adapted instanceof CommentEntry) {
            comments.add((CommentEntry) adapted);
        }
    }
    return comments;
}
 

开发者ID:Dotosoft,
项目名称:dotoquiz-tools,
代码行数:20,
代码来源:PicasawebClient.java

示例5: downloadImage

点赞 3

import com.google.gdata.data.photos.PhotoEntry; //导入依赖的package包/类
private boolean downloadImage( ImageSync image, PicasawebClient webClient ) {
    try {
        PhotoEntry photo = image.getRemotePhoto();
        File saveLocation = image.getLocalFile();

        if( webClient.downloadPhoto(saveLocation, photo) )
        {
            // Set the local folder timestamp based on the downloaded file
            updateFolderTimeStamp( localFolder );
        }

        return true;

    } catch (Exception ex) {

        log.error("Exception reading local save location...", ex);
    }

    return false;
}
 

开发者ID:Webreaper,
项目名称:GooglePhotoSync,
代码行数:21,
代码来源:AlbumSync.java

示例6: createComment

点赞 2

import com.google.gdata.data.photos.PhotoEntry; //导入依赖的package包/类
private void createComment(PhotoEntry photoEntry) throws Exception {
  CommentEntry comment = new CommentEntry();

  String gphotoId = photoEntry.getGphotoId();
  comment.setPhotoId(Long.parseLong(gphotoId));
  comment.setTitle(new PlainTextConstruct("Inserted Comment"));

  String commentStr = getString("Comment");
  comment.setContent(new PlainTextConstruct(commentStr));

  insert(photoEntry, comment);
}
 

开发者ID:google,
项目名称:gdata-java-client,
代码行数:13,
代码来源:PicasawebCommandLine.java

示例7: showPhotoTags

点赞 2

import com.google.gdata.data.photos.PhotoEntry; //导入依赖的package包/类
private void showPhotoTags(AlbumEntry albumEntry, List<PhotoEntry> photos)
    throws Exception {
  PhotoEntry photoEntry;
  try {
    photoEntry = getEntry(photos, "photo");
  } catch (ExitException ee) {
    return;
  }

  List<TagEntry> photoTags = getTags(photoEntry);

  printTags(photoTags);
  while (true) {
    println("Tag Menu:");
    println("0) Exit to photo menu");
    println("1) Add a tag");
    println("2) Delete a tag");
    int choice = getInt("Action");
    switch (choice) {
    case -1:
      continue;
    case 0:
      return;
    case 1:
      createTag(photoEntry);
      showPhotoTags(albumEntry, photos);
      return;
    case 2:
      deleteEntry(photoTags, "tag");
      showPhotoTags(albumEntry, photos);
      return;
    default:
      println("Invalid choice " + choice);
      break;
    }
  }
}
 

开发者ID:google,
项目名称:gdata-java-client,
代码行数:38,
代码来源:PicasawebCommandLine.java

示例8: createTag

点赞 2

import com.google.gdata.data.photos.PhotoEntry; //导入依赖的package包/类
private void createTag(PhotoEntry photoEntry) throws Exception {
  TagEntry tag = new TagEntry();

  String title = getString("Tag");
  tag.setTitle(new PlainTextConstruct(title));

  insert(photoEntry, tag);
}
 

开发者ID:google,
项目名称:gdata-java-client,
代码行数:9,
代码来源:PicasawebCommandLine.java

示例9: declareExtensions

点赞 2

import com.google.gdata.data.photos.PhotoEntry; //导入依赖的package包/类
/**
 * Declare the extensions of the feeds for the Picasa Web Albums Data API.
 */
private void declareExtensions() {
  extProfile.setAutoExtending(true);
  new AlbumEntry().declareExtensions(extProfile);
  new AlbumFeed().declareExtensions(extProfile);
  new CommentEntry().declareExtensions(extProfile);
  new PhotoEntry().declareExtensions(extProfile);
  new PhotoFeed().declareExtensions(extProfile);
  new TagEntry().declareExtensions(extProfile);
  new UserEntry().declareExtensions(extProfile);
  new UserFeed().declareExtensions(extProfile);
}
 

开发者ID:google,
项目名称:gdata-java-client,
代码行数:15,
代码来源:PicasawebService.java

示例10: UniquePhoto

点赞 2

import com.google.gdata.data.photos.PhotoEntry; //导入依赖的package包/类
public UniquePhoto( PhotoEntry photo )
{
    try{
        setDateTimeTaken(photo.getTimestamp().getTime());
    }
    catch( Exception ex)
    {
        // don't care
    }
    setUniqueExifID(photo.getExifTags().getImageUniqueID());
    setCheckSum(photo.getChecksum());
    setFileName( photo.getTitle().getPlainText() );
}
 

开发者ID:Dotosoft,
项目名称:dotoquiz-tools,
代码行数:14,
代码来源:UniquePhoto.java

示例11: createPhotoEntry

点赞 2

import com.google.gdata.data.photos.PhotoEntry; //导入依赖的package包/类
public PhotoEntry createPhotoEntry (String title, String description, File fileImage) {
	PhotoEntry myPhoto = new PhotoEntry();
	myPhoto.setTitle(new PlainTextConstruct(title));
	myPhoto.setDescription(new PlainTextConstruct(description));
	myPhoto.setClient( QuizParserConstant.SYNC_CLIENT_NAME );

	MediaFileSource myMedia = new MediaFileSource(fileImage, "image/jpeg");
	myPhoto.setMediaSource(myMedia);
	
	return myPhoto;
}
 

开发者ID:Dotosoft,
项目名称:dotoquiz-tools,
代码行数:12,
代码来源:PicasawebClient.java

示例12: setUpdatedDate

点赞 2

import com.google.gdata.data.photos.PhotoEntry; //导入依赖的package包/类
public void setUpdatedDate( GphotoEntry album, final PhotoEntry photoToChange, File localFile )
{
    try
    {
        final boolean SETUPDATE_WORKS = false;

        if( SETUPDATE_WORKS )
        {
            List<GphotoEntry> photos = getPhotos(album);

            for (GphotoEntry photo : photos)
            {
                if (photo.getGphotoId().equals(photoToChange.getGphotoId()))
                {
                    DateTime time = new DateTime(localFile.lastModified());
                    time.setTzShift(0);

                    log.info( "Setting Updated from " + photo.getUpdated() + " to " + time );
                    photo.setUpdated(time);
                    photo.update();
                    break;
                }
            }
        }
        else
        {
            // Since it doesn't work, the only option to avoid unnecessary uploads/downloads
            // is to set the lastModified file time on the local file.
            log.info("Setting local file time to " + photoToChange.getUpdated() + " for " + localFile.getName() );
            localFile.setLastModified( photoToChange.getUpdated().getValue() );
        }
    }
    catch( Exception ex )
    {
        log.error("Unable to change lastUpdate date for " + photoToChange.getTitle().getPlainText() );
    }
}
 

开发者ID:Dotosoft,
项目名称:dotoquiz-tools,
代码行数:38,
代码来源:PicasawebClient.java

示例13: getPhotoId

点赞 2

import com.google.gdata.data.photos.PhotoEntry; //导入依赖的package包/类
public static String getPhotoId( PhotoEntry photo )
{
    final String PHOTOID = "photoid/";
    String id;

    int index = photo.getId().indexOf( PHOTOID );
    id = photo.getId().substring( index + PHOTOID.length() );
    return id;
}
 

开发者ID:Dotosoft,
项目名称:dotoquiz-tools,
代码行数:10,
代码来源:PicasawebClient.java

示例14: movePhoto

点赞 2

import com.google.gdata.data.photos.PhotoEntry; //导入依赖的package包/类
public void movePhoto(PhotoEntry photo, AlbumEntry destinationAlbum) throws ServiceException, IOException
{
    log.info("Moving photo " + photo.getTitle().getPlainText() + " to " + destinationAlbum.getTitle().getPlainText() );

    AlbumFeed feed = destinationAlbum.getFeed();
    String id = feed.getGphotoId();
    photo.setAlbumId(id );
    photo.update();
}
 

开发者ID:Dotosoft,
项目名称:dotoquiz-tools,
代码行数:10,
代码来源:PicasawebClient.java

示例15: getPhotos

点赞 2

import com.google.gdata.data.photos.PhotoEntry; //导入依赖的package包/类
/**
 * Retrieves the photos for the given album.
 */
public List<PhotoEntry> getPhotos(AlbumEntry album) throws IOException,
        ServiceException {

    List<PhotoEntry> photos = new ArrayList<PhotoEntry>();

    // If it doesn't have an ID, it's an album we haven't created yet!
    if( album.getLinks().size() != 0 ) {
        String feedHref = getLinkByRel(album.getLinks(), Link.Rel.FEED);

        feedHref = addParameter(feedHref, "imgmax", "d");
        feedHref = addParameter(feedHref, "max-results", "1000");

        while (feedHref != null) {
            AlbumFeed albumFeed = getFeed(feedHref, AlbumFeed.class);

            List<GphotoEntry> entries = albumFeed.getEntries();
            for (GphotoEntry entry : entries) {
                GphotoEntry adapted = entry.getAdaptedEntry();
                if (adapted instanceof PhotoEntry) {
                    photos.add((PhotoEntry) adapted);
                }
            }

            Link nextLink = albumFeed.getNextLink();
            if (nextLink != null) {
                feedHref = nextLink.getHref();
            } else {
                feedHref = null;
            }
        }
    }

    TimeUtils.sortPhotoEntriesNewestFirst(photos);

    return photos;
}
 

开发者ID:Dotosoft,
项目名称:dotoquiz-tools,
代码行数:40,
代码来源:PicasawebClient.java

示例16: sortPhotoEntriesNewestFirst

点赞 2

import com.google.gdata.data.photos.PhotoEntry; //导入依赖的package包/类
public static void sortPhotoEntriesNewestFirst( List<PhotoEntry> photos )
{
    Collections.sort(photos, new Comparator<PhotoEntry>()
    {
        public int compare(PhotoEntry x, PhotoEntry y)
        {
            return y.getUpdated().compareTo(x.getUpdated());
        }
    });
}
 

开发者ID:Dotosoft,
项目名称:dotoquiz-tools,
代码行数:11,
代码来源:TimeUtils.java

示例17: recyclePhoto

点赞 2

import com.google.gdata.data.photos.PhotoEntry; //导入依赖的package包/类
public void recyclePhoto( ImageSync image ) throws IOException, ServiceException
{
    // Check that the album exists, create it and save if it doesn't.
    recycleAlbum = webClient.prepareRemoteAlbum( recycleAlbum );

    if( recycleAlbum != null )
    {
        PhotoEntry photo = image.getRemotePhoto();

        try
        {
            log.info("Moving image " + image.getLocalFile() + " to trash...");
            FileUtilities.moveToTrash(image.getLocalFile());

            if (photo != null)
            {
                log.info("Moving image " + image.getLocalFile() + " to Recycle Bin album...");

                if( recycleAlbum.getPhotosLeft() == 0 )
                {
                    recycleAlbum.setName("Recycle Bin");
                    recycleAlbum.update();
                }

                webClient.movePhoto(photo, recycleAlbum);
                deletedPhotos.add( new UniquePhoto(photo).getUniqueIdentifier() );
            }
        }
        catch( Exception ex )
        {
            log.error("Unable to recycle photo.", ex );
        }
    }
}
 

开发者ID:Webreaper,
项目名称:GooglePhotoSync,
代码行数:35,
代码来源:SyncManager.java

示例18: uploadPhoto

点赞 2

import com.google.gdata.data.photos.PhotoEntry; //导入依赖的package包/类
/**
 * Uploads a photo to a hosting service and returns the publicly-accessible URI to be used in the markdown of a new issue.
 * 
 * @param img
 * @return
 */
public static String uploadPhoto(BufferedImage image) throws IOException {
    if (image == null) {
        throw new IOException("image was null", new NullPointerException());
    }
    String publicLinkToPhoto = null;
    synchronized (singleton) {
        if (singleton.photoService == null) {
            throw new IOException("Could not authenticate with Picassa");
        }

        singleton.baos.reset();
        ImageIO.write(image, "png", singleton.baos);
        MediaByteArraySource myMedia = new MediaByteArraySource(singleton.baos.toByteArray(), "image/png");

        PhotoEntry returnedPhoto;
        try {
            returnedPhoto = singleton.photoService.insert(singleton.pdfAlbumUrl, PhotoEntry.class, myMedia);
        } catch (ServiceException e) {
            e.printStackTrace();
            throw new IOException("Problem uploading photo", e);
        }

        publicLinkToPhoto = returnedPhoto.getMediaThumbnails().get(0).getUrl();

        // scale it up to 800 px, which is the largest we can hotlink to
        publicLinkToPhoto = publicLinkToPhoto.replace("/s72/", "/s800/").replace("/s144/", "/s800/").replace("/s288/", "/s800/");
    }
    return publicLinkToPhoto;
}
 

开发者ID:DeveloperLiberationFront,
项目名称:Pdf-Reviewer,
代码行数:36,
代码来源:ImageUtils.java

示例19: showAlbumPhotos

点赞 2

import com.google.gdata.data.photos.PhotoEntry; //导入依赖的package包/类
private void showAlbumPhotos(List<AlbumEntry> albums) throws Exception {

    AlbumEntry albumEntry;
    try {
      albumEntry = getEntry(albums, "album");
    } catch (ExitException ee) {
      return;
    }

    List<PhotoEntry> photos = getPhotos(albumEntry);
    int count = 1;
    if (photos.size() == 0) {
      println("No photos found.");
    } else {
      for (PhotoEntry entry : photos) {
        println("Photo " + count++ + ") " + entry.getTitle().getPlainText());
        println(entry.getDescription().getPlainText());
      }
    }
    while (true) {
      println("Photo Menu:");
      println("0) Exit to album menu");
      println("1) Show photo comments");
      println("2) Show photo tags");
      println("3) Create a new photo");
      println("4) Delete a photo");
      int choice = getInt("Action");
      switch (choice) {
      case -1:
        continue;
      case 0:
        return;
      case 1:
        showPhotoComments(albumEntry, photos);
        break;
      case 2:
        showPhotoTags(albumEntry, photos);
        break;
      case 3:
        createPhoto(albumEntry);
        break;
      case 4:
        deleteEntry(photos, "photo");
        break;
      default:
        println("Invalid choice " + choice);
        break;
      }
    }
  }
 

开发者ID:google,
项目名称:gdata-java-client,
代码行数:51,
代码来源:PicasawebCommandLine.java

示例20: showPhotoComments

点赞 2

import com.google.gdata.data.photos.PhotoEntry; //导入依赖的package包/类
private void showPhotoComments(AlbumEntry albumEntry, List<PhotoEntry> photos)
    throws Exception {

  PhotoEntry photoEntry;
  try {
    photoEntry = getEntry(photos, "photo");
  } catch (ExitException ee) {
    return;
  }

  List<CommentEntry> comments = getComments(photoEntry);
  int count = 1;
  if (comments.size() == 0) {
    println("No comments found.");
  } else {
    for (CommentEntry comment : comments) {
      println("Comment " + count++ + ") " + comment.getTitle().getPlainText());
      println(comment.getPlainTextContent());
    }
  }
  while (true) {
    println("Comment Menu:");
    println("0) Exit to photo menu");
    println("1) Add a comment");
    println("2) Delete a comment");
    int choice = getInt("Action");
    switch (choice) {
    case -1:
      continue;
    case 0:
      return;
    case 1:
      createComment(photoEntry);
      showPhotoComments(albumEntry, photos);
      return;
    case 2:
      deleteEntry(comments, "comment");
      showPhotoComments(albumEntry, photos);
      return;
    default:
      println("Invalid choice " + choice);
      break;
    }
  }
}
 

开发者ID:google,
项目名称:gdata-java-client,
代码行数:46,
代码来源:PicasawebCommandLine.java

示例21: uploadImageToAlbum

点赞 2

import com.google.gdata.data.photos.PhotoEntry; //导入依赖的package包/类
public GphotoEntry uploadImageToAlbum(File imageFile, GphotoEntry remotePhoto, GphotoEntry albumEntry, String localMd5CheckSum ) throws Exception {

        boolean newPhoto = false;
        String albumName = albumEntry.getTitle().getPlainText();
        PhotoEntry  myPhoto = new PhotoEntry();
        
        if( remotePhoto == null || !StringUtils.hasValue(remotePhoto.getId()) )
        {
            newPhoto = true;
            log.info( "Uploading new image to album " + albumName + ": " + imageFile);
        }
        else{
        	// BeanUtils.copyProperties(myPhoto, remotePhoto);
        	remotePhoto.delete();
            log.info( "Uploading updated image in album " + albumName + ": " + imageFile);
        }


        try{
        	MediaFileSource myMedia = new MediaFileSource(imageFile, "image/jpeg");
        	myPhoto.setMediaSource(myMedia);
			myPhoto.setChecksum( localMd5CheckSum );
			myPhoto.setAlbumAccess(GphotoAccess.Value.PUBLIC);
			myPhoto.setClient( QuizParserConstant.SYNC_CLIENT_NAME );
			
            if( newPhoto)
            {
                myPhoto.setTitle(new PlainTextConstruct(imageFile.getName()));
            }
            else
            {
            	myPhoto.setTitle(remotePhoto.getTitle());
            }
            
            myPhoto = insert(albumEntry, myPhoto);
        } catch (Exception ex) {
            log.error("Unable to add media: " + imageFile + ": " + ex);
        } finally {
        	 setUpdatedDate( albumEntry, myPhoto, imageFile );
        }
        
        return myPhoto;
    }
 

开发者ID:Dotosoft,
项目名称:dotoquiz-tools,
代码行数:44,
代码来源:PicasawebClient.java

示例22: getRemotePhoto

点赞 2

import com.google.gdata.data.photos.PhotoEntry; //导入依赖的package包/类
public PhotoEntry getRemotePhoto() {
    return remotePhoto;
}
 

开发者ID:Webreaper,
项目名称:GooglePhotoSync,
代码行数:4,
代码来源:ImageSync.java

示例23: ImageSync

点赞 2

import com.google.gdata.data.photos.PhotoEntry; //导入依赖的package包/类
public ImageSync(PhotoEntry remotePhoto, File localFileName)
{
    this.remotePhoto = remotePhoto;
    this.localFile = localFileName;
}
 

开发者ID:Webreaper,
项目名称:GooglePhotoSync,
代码行数:6,
代码来源:ImageSync.java

示例24: localCopyNeedsUpdating

点赞 2

import com.google.gdata.data.photos.PhotoEntry; //导入依赖的package包/类
private boolean localCopyNeedsUpdating( PhotoEntry photo, File localPath )throws ImageReadException, IOException, ServiceException
{
    boolean updateLocal = false;
    if( localPath.exists() ) {

        LocalDateTime localMod = getTimeFromMS( localPath.lastModified() );
        LocalDateTime remoteMod = getTimeFromMS(photo.getUpdated().getValue());
        long seconds = ChronoUnit.SECONDS.between(localMod, remoteMod);
        if( Math.abs( seconds ) > 1 )
            return true;

        long localFileSize = localPath.length();
        long remoteFileSize = photo.getSize();
        if( localFileSize != remoteFileSize )
        {
            log.info(String.format( "File sizes are different: (local %s vs remote %s). Local file will be updated.",
                    FileUtils.byteCountToDisplaySize(localFileSize), FileUtils.byteCountToDisplaySize( remoteFileSize) ));
            return true;
        }

        ImageInformation localInfo = ImageInformation.safeReadImageInformation(localPath);

        if (localInfo != null ) {

            Integer rotation = photo.getRotation();
            if( rotation != null )
                log.info("PhotoEntry rotation was set!");

            // Make sure we take into account the rotation of the image when comparing width/height
            long localWidth = localInfo.getWidthHeightTransposed() ? localInfo.getHeight() : localInfo.getWidth();
            long localHeight = localInfo.getWidthHeightTransposed() ? localInfo.getWidth() : localInfo.getHeight();

            if (localWidth != photo.getWidth() || localHeight != photo.getHeight())
            {
                log.info(String.format( "Image dimensions are different: (local %dx%d vs remote %dx%d). Local file will be updated.", localInfo.getWidth(), localInfo.getHeight(), photo.getWidth(), photo.getHeight() ));

                return true;
            }
        }
        else
        {
            log.warn("Local file was not image! Renaming before overwrite. (" + localPath.getName() + ")");

            File renamed = new File( localPath + ".old" );
            if( ! localPath.renameTo( renamed ) )
                log.warn( "Unable to rename file");

            updateLocal = true;
        }

    }
    else
    {
        log.debug("No local file existed: " + localPath );
        // Nothing here, so always write
        updateLocal = true;
    }

    return updateLocal;
}
 

开发者ID:Webreaper,
项目名称:GooglePhotoSync,
代码行数:61,
代码来源:ImageSync.java

示例25: getAllImage

点赞 2

import com.google.gdata.data.photos.PhotoEntry; //导入依赖的package包/类
public List<String> getAllImage()
{
    String userName ="YOUR GOOGLE PICASA USERNAME";
    String password = "YOUR GOOGLE PICASA PASSWORD";
    System.out.println("Inside getallimage");
    PicasawebService myService = new PicasawebService("exampleCo-exampleApp-1");
    List<String> listUrl = new LinkedList<String>();
    try
    {
        myService.setUserCredentials(userName, password);
        URL feedUrl = new URL("https://picasaweb.google.com/data/feed/api/user/"+userName+"?kind=album");

        UserFeed myUserFeed = myService.getFeed(feedUrl, UserFeed.class);

        String id = "";
        List<AlbumEntry> albumEntries = myUserFeed.getAlbumEntries();
        System.out.println(albumEntries.isEmpty());
        AlbumEntry myAlbum = albumEntries.get(1);
            id = myAlbum.getGphotoId();
            System.out.println(id);
            //System.out.println(service.parseURL(id));


        System.out.println("UserName :"+userName);
        URL albumUrl = new URL("https://picasaweb.google.com/data/feed/api/user/"+userName+"/albumid/"+parseURL(id));
        System.out.println(albumUrl.toString());
        AlbumFeed feed = myService.getFeed(albumUrl, AlbumFeed.class);


        for(PhotoEntry photo : feed.getPhotoEntries()) {
            System.out.println("Photos");
            String photoUrl = photo.getTitle().getPlainText();
            System.out.println(parsePhotoUrl(photo.getMediaThumbnails().get(0).getUrl()));
            listUrl.add(parsePhotoUrl(photo.getMediaThumbnails().get(0).getUrl()));
        }
    }catch (Exception e)
    {
        e.printStackTrace();
    }
    
    System.out.println("Returning listUrl");
    return listUrl;
}
 

开发者ID:Anilshrestha,
项目名称:Incredible-Earth-Space-APP-Challenge-,
代码行数:44,
代码来源:ImageService.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)