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

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

java 2次浏览

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

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

示例1: main

点赞 3

import com.google.gdata.client.photos.PicasawebService; //导入依赖的package包/类
/**
 * Main loop, runs the client application against the standard service, and
 * asks the user for their username and password.
 */
public static void main(String[] args) throws Exception {

  try {
    PicasawebService service = new PicasawebService("exampleClient");

    String uname, passwd;
    if (args.length == 2) {
      uname = args[0];
      passwd = args[1];
    } else if (args.length != 0) {
      println("Syntax: PicasawebCommandLine <username> <password>");
      return;
    } else {
      uname = getString("Username");
      passwd = getString("Password");
    }

    new PicasawebCommandLine(service, uname, passwd).mainLoop();

  } catch (ExitException ee) {
    println("Exiting...");
  }
}
 

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

示例2: PicasawebClient

点赞 2

import com.google.gdata.client.photos.PicasawebService; //导入依赖的package包/类
/**
 * Constructs a new client with the given username and password.
 */
public PicasawebClient(PicasawebService service, String uname,
    String passwd) {
  this.service = service;

  if (uname != null && passwd != null) {
    try {
      service.setUserCredentials(uname, passwd);
    } catch (AuthenticationException e) {
      throw new IllegalArgumentException(
          "Illegal username/password combination.");
    }
  }
}
 

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

示例3: ImageUtils

点赞 2

import com.google.gdata.client.photos.PicasawebService; //导入依赖的package包/类
private ImageUtils() {
    photoService = new PicasawebService("ncsu-pdfreviewer-0.1");

    String clientID = System.getenv("PICASSA_CLIENT_ID");
    String clientSecret = System.getenv("PICASSA_CLIENT_SECRET");
    String refreshToken = System.getenv("PICASSA_REFRESH_TOKEN");

    String pdfAlbumId = System.getenv("PICASSA_PDF_ALBUM_ID");

    try {
        pdfAlbumUrl = new URL("https://picasaweb.google.com/data/feed/api/user/default/albumid/" + pdfAlbumId);

        HttpTransport transport = new NetHttpTransport();
        JsonFactory jsonFactory = new JacksonFactory();

        //get a current token
        GoogleRefreshTokenRequest req = new GoogleRefreshTokenRequest(transport, jsonFactory, refreshToken, clientID, clientSecret);
        GoogleTokenResponse res = req.execute();
        String accessToken = res.getAccessToken();
        
        //build a refreshable credential
        Credential credential = new GoogleCredential.Builder()
        .setClientSecrets(clientID, clientSecret)
        .setJsonFactory(jsonFactory)
        .setTransport(transport)
        .build();
        
        //Load OAuth2 credential
        credential.setAccessToken(accessToken);
        credential.setRefreshToken(refreshToken);
        photoService.setOAuth2Credentials(credential);
    } catch (IOException e) {
        e.printStackTrace();
        photoService = null;
    }
}
 

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

示例4: PicasawebPartialDemo

点赞 2

import com.google.gdata.client.photos.PicasawebService; //导入依赖的package包/类
/** Constructor */
private PicasawebPartialDemo(PicasawebService service) {
  this.service = service;
}
 

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

示例5: PicasawebCommandLine

点赞 2

import com.google.gdata.client.photos.PicasawebService; //导入依赖的package包/类
/**
 * Constructs the command line application.
 */
public PicasawebCommandLine(PicasawebService service, String uname,
    String passwd) {
  super(service, uname, passwd);
}
 

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

示例6: getAllImage

点赞 2

import com.google.gdata.client.photos.PicasawebService; //导入依赖的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)