Examples of Flickr


Examples of com.aetrion.flickr.Flickr


        //turn on debugging
        Flickr.debugStream = true;
        Flickr.debugRequest = true;
        Flickr flickr = new Flickr(
                key,shared,
                new REST()
        );

        /*
        //
        RequestContext context = RequestContext.getRequestContext();
        //ask user to authenticate on the web
        AuthInterface authInterface = flickr.getAuthInterface();
        try {
            frob = authInterface.getFrob();
        } catch (FlickrException e) {
            e.printStackTrace();
        }
        System.out.println("frob: " + frob);
        URL url = authInterface.buildAuthenticationUrl(Permission.DELETE, frob);
        System.out.println("Press return after you granted access at this URL:");
        System.out.println(url.toExternalForm());

        //wait for return
        BufferedReader infile = new BufferedReader ( new InputStreamReader(System.in) );
        String line = infile.readLine();


        try {
            Auth auth = authInterface.getToken(frob);
            System.out.println("Authentication success");
            // This token can be used until the user revokes it.
            System.out.println("Token: " + auth.getToken());
            System.out.println("nsid: " + auth.getUser().getId());
            System.out.println("Realname: " + auth.getUser().getRealName());
            System.out.println("Username: " + auth.getUser().getUsername());
            System.out.println("Permission: " + auth.getPermission().getType());
        } catch (FlickrException e) {
            System.out.println("Authentication failed");
            e.printStackTrace();
        }
*/
       
        AuthInterface authInterface = flickr.getAuthInterface();
        Auth auth = authInterface.checkToken("72157625348978315-7c9ef5a03dc17410");
        RequestContext context = RequestContext.getRequestContext();
        context.setAuth(auth);

        Uploader up = new Uploader(key, shared);
View Full Code Here

Examples of com.aetrion.flickr.Flickr

        }
        this.context.addNotification("Uploading to Flickr");
        new Thread(new Runnable(){
            public void run() {
                try {
                    Flickr flickr = new Flickr(
                            key,shared,
                            new REST()
                    );

                    AuthInterface authInterface = flickr.getAuthInterface();
                    Auth auth = authInterface.checkToken(context.getSettings().getProperty(FLICKR_USER_TOKEN));
                    RequestContext context = RequestContext.getRequestContext();
                    context.setAuth(auth);

                    Uploader up = new Uploader(key, shared);
View Full Code Here

Examples of com.aetrion.flickr.Flickr

        }

        private void authenticate() throws ParserConfigurationException, IOException, SAXException {
            Flickr.debugStream = true;
            Flickr.debugRequest = true;
            Flickr flickr = new Flickr(
                    key,shared,
                    new REST()
            );
            final RequestContext context = RequestContext.getRequestContext();
            //ask user to authenticate on the web
            final AuthInterface authInterface = flickr.getAuthInterface();
            try {
                frob = authInterface.getFrob();
            } catch (FlickrException e) {
                e.printStackTrace();
            }
View Full Code Here

Examples of com.aetrion.flickr.Flickr

      photoCount = 1;
     
    //
      // Connect to flickr
      //
    Flickr flickr = new Flickr( this._api_key, this._api_secret, rest );
   
    PhotoList newPhotoList = null;
   
    String userToken = Program.getProperty( "flickr.userToken" );
    String sPhotosets = Program.getProperty( "flickr.photosets" );
   
    if( sPhotosets != "" )
    {
      PhotosetsInterface photosetsI = flickr.getPhotosetsInterface();
     
      Photosets photosets = null;
     
      try
      {
        photosets = photosetsI.getList(userToken);
      }
      catch (Exception e) //IOException e2, SAXException e2, FlickrException e2) {
      {
        e.printStackTrace();
        return null;
      }
     
      if( photosets != null )
      {
        // If we have a list of photosets, just get the photos from there.
        @SuppressWarnings("unchecked")
        Collection<Photoset> photosetCollection = photosets.getPhotosets();
     
        PhotoList photosetsPhotoList = new PhotoList();
       
        String[] photosetsNamesArray = sPhotosets.split(";");
       
        int photosetsPhotoCount = photoCount / photosetsNamesArray.length;
        int photosetsPhotoCountExtra = 0;
        for( Photoset photoset : photosetCollection )
        {
          String photosetName = photoset.getTitle();
          for( int i = 0; i<photosetsNamesArray.length;i++)
          {
            if( photosetsNamesArray[i] != "" &&
                photosetsNamesArray[i].compareToIgnoreCase(photosetName) == 0 )
            {
              PhotoList photoList = null;
              try
              {
                photoList = photosetsI.getPhotos(photoset.getId(), photosetsPhotoCount + photosetsPhotoCountExtra, 1);
              }
              catch( Exception e) //catch (IOException e), catch (SAXException e), catch (FlickrException e)
              {
                e.printStackTrace();
                return null;
              }
             
              if( photoList != null )
              {
                @SuppressWarnings("unchecked")
                Iterator<com.aetrion.flickr.photos.Photo> p = (Iterator<com.aetrion.flickr.photos.Photo>)photoList.iterator();
               
                int photosAdded = 0;
                  for(; p.hasNext();)
                  {
                    com.aetrion.flickr.photos.Photo photo = p.next();
                    if( ! photosetsPhotoList.contains(photo) )
                    {
                      photosetsPhotoList.add(photo);
                      photosAdded++;
                    }
                  }
                 
                photosetsPhotoCountExtra += photosetsPhotoCount - photosAdded;
              }
            }
          }
        }
        newPhotoList = photosetsPhotoList;
      }
    }
    else
    {
      PeopleInterface pi = flickr.getPeopleInterface();
     
      try
      {
        newPhotoList = pi.getPublicPhotos(userToken, photoCount,1);
      }
View Full Code Here

Examples of com.aetrion.flickr.Flickr

  public FlickrLoader(PApplet pa, String flickrKey, String flickrSecret, SearchParameters sp, long sleepTime) {
    super(sleepTime);
    this.pa = pa;
   
    try {
      f = new Flickr(flickrKey, flickrSecret, new REST());
    } catch (ParserConfigurationException e) {
      e.printStackTrace();
    }
    authInterface  = f.getAuthInterface();
    requestContext   = RequestContext.getRequestContext();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.