Flickr API

De Wikijoan
Dreceres ràpides: navegació, cerca

Login Flickr: joan_quintana / jq****

Contingut

Flickr API

Programo amb C, faig servir la API de C:

Download:

requirements:

sudo apt-get install libxml2 libxml2-dev
$ sudo apt-get install libcurl4-gnutls-dev
sudo apt-get install libraptor1-dev
$ cd flickcurl-1.22/
./configure
make
sudo make install

Flickr API Configuration

The library needs to know your Flickr API application key, authentication token and shared secret, suitable for calling some of the API calls. To obtain these, you need to apply for API keys at the Flickr Services site (http://www.flickr.com/services/apps/create/apply). When using the utility programs, this information should be stored in the ~/.flickcurl.conf file so that it can be read at run-time. The configuration file has the format:

[flickr]
auth_token=1234567-8901234567890123
api_key=0123456789abcdef0123456789abcdef
secret=fedcba9876543210
Here's the API key and secret for your new app:
	arthropoda

Key:
6a36a8d6c910fb78f1e8ac294adb163d
Secret:
xxxx (veure fitxer)
[flickr]
auth_token=72157629617844371-a95e52358c218462
api_key=6a36a8d6c910fb78f1e8ac294adb163d
secret=98b3d6e7c840dcff

Començar a programar

$ flickcurl photos.getInfo 196308964
flickcurl: error while loading shared libraries: libflickcurl.so.0: cannot open shared object file: No such file or directory

La manera ràpida de resoldre-ho és fer:

$ export LD_LIBRARY_PATH=/usr/local/lib
$ flickcurl photos.getInfo 196308964
flickcurl: Configuration file /home/joan/.flickcurl.conf not found.

1. Visit http://www.flickr.com/services/api/keys/ and obtain a
mobile application <API Key>, <Shared Secret> and <Authentication URL>.

2. Create /home/joan/.flickcurl.conf in this format:
[flickr]
api_key=<API Key>
secret=<Shared Secret>

3. Visit the <Authentication URL> in a browser to get a <FROB>

4. Call this program with the frob:
  flickcurl -a <FROB>
to update the configuration file with the authentication token.
See http://librdf.org/flickcurl/api/flickcurl-auth.html for full instructions.

i ara ja funciona: (196308964 és un id únic per a una foto que existeix a Flickr. És una foto pública, no és meva)

$ flickcurl photos.getInfo 196308964
flickcurl: photo with URI http://www.flickr.com/photos/dajobe/196308964/ ID 196308964 and 5 tags
    field dateuploaded (1) with dateTime value: '2006-07-23T18:16:13Z' / 1153678573
    field farm (2) with integer value: '1' / 1
    field isfavorite (3) with boolean value: '0' / 0
    field license (4) with integer value: '1' / 1
    field originalformat (5) with string value: 'jpg' / -1
...

Exemple: examples/print-photo-info.c

Per compilar:

$ gcc -o print-photo-info print-photo-info.c `flickcurl-config --cflags` `flickcurl-config --libs`
$ ./print-photo-info

En el codi poso un id_foto que sigui meu:

  photo=flickcurl_photos_getInfo(fc, "6995973801"); /* photo ID */

la Key i el Secret, però em falta el auth-token... què és? He d'anar a Edit the authentication flow

Molt fàcil, he de visitar la url que em diuen. El auth_token només el necessito si la meva aplicació és mobile. Com que la meva aplicació és Desktop, senzillament aquesta línia la comento.

  /* Set configuration, or more likely read from a config file */
  flickcurl_set_api_key(fc, "6a36a8d6c910fb78f1e8ac294adb163d");
  flickcurl_set_shared_secret(fc, "...");
  //flickcurl_set_auth_token(fc, "692-418-152");

En les proves que he fet he obtingut un auth_token (veure més avall sobre la configuració correcta del auth_token)

auth-token: 692-418-152 (aquest no és el auth-toke, és el FROB. Veure més avall).

Tanmateix, deixo la configuració de la meva aplicació com a Desktop.

Ara ja puc executar print-photo-info i veure tota la informació de què consta una foto:

$ ./print-photo-infofield
dateuploaded (1) with dateTime value: '2012-03-19T07:47:59Z' / 1332143279
field farm (2) with integer value: '7' / 7
field isfavorite (3) with boolean value: '0' / 0
field license (4) with integer value: '0' / 0
field rotation (6) with integer value: '0' / 0
field server (7) with integer value: '6214' / 6214
field dates_lastupdate (8) with dateTime value: '2012-03-19T07:48:01Z' / 1332143281
field dates_posted (9) with dateTime value: '2012-03-19T07:47:59Z' / 1332143279
field dates_taken (10) with string value: '2012-03-19 08:47:59' / -1
field dates_takengranularity (11) with integer value: '0' / 0
field editability_canaddmeta (13) with boolean value: '0' / 0
field editability_cancomment (14) with boolean value: '0' / 0
field owner_location (22) with string value: 'Barcelona, Spain' / -1
field owner_nsid (23) with string value: '37546322@N00' / -1
field owner_realname (24) with string value: 'Joan Quintana' / -1
field owner_username (25) with string value: 'joanillo quintana' / -1
field title (26) with string value: 'pere_i_llop1' / -1
field visibility_isfamily (27) with boolean value: '0' / 0
field visibil
ity_isfriend (28) with boolean value: '0' / 0
field visibility_ispublic (29) with boolean value: '1' / 1
field secret (30) with string value: '7e94364aa7' / -1
field usage_candownload (49) with boolean value: '1' / 1
field usage_canblog (50) with boolean value: '0' / 0
field usage_canprint (51) with boolean value: '0' / 0
field views (56) with integer value: '0' / 0

Totes les meves aplicacions estan enllaçades en aquest link:

FROB i auth_token. Configuració

Només cal seguir les instruccions correctament.

Quan faig Edit the authentication flow, puc escollir entre tres opcions:

Encara que la meva aplicació escrita en C serà Desktop, he d'escollir Mobile Application doncs és la única opció que em deixa fer read/write/delete i que em deixarà fer upload (és a dir, write) de fotos. Per tant, escullo aquesta opció, i em diu quina és la URL a la que m'he de connectar per obtenir un FROB. Per exemple,

i obtinc 608-379-556'. Però el FROB no és el auth_key, i per configurar correctament el fitxer de configuració s'ha de fer:

$ ./flickcurl -a 608-379-556 -> aquest és el valor del FROB (però no és el auth-key!!)
lt-flickcurl: Successfully exchanged frob 608-379-556 for authentication token
lt-flickcurl: Updated configuration file /home/joan/.flickcurl.conf with authentication token

i ara si miro el fitxer de configuració ja ha incorporat el valor correcte del auth_token: (ha afegit automàticament una línia)

[flickr]
auth_token=72157629617844371-a95e52358c218462
api_key=6a36a8d6c910fb78
secret=....

Ara ja podré penjar fitxers com es demostra a continuació.

flickcurl: fer upload d'una foto

Veig que aquesta aplicació d'exemple té moltíssims paràmetres. Per exemple, l'argument upload. Convé entretindre's en el funcionament d'aquesta aplicació

$ ./flickcurl --help
Flickr API utility 1.22
Call the Flickr API to get information.
Usage: lt-flickcurl [OPTIONS] command args...

Copyright (C) 2007-2011 David Beckett - http://www.dajobe.org/
License: LGPL 2.1 or newer, GPL 2 or newer, Apache 2.0 or newer.
See http://librdf.org/flickcurl/ for full terms.
Flickcurl home page: http://librdf.org/flickcurl/

  -a, --auth FROB         Authenticate with a FROB and write auth config
  -d, --delay DELAY       Set delay between requests in milliseconds
  -h, --help              Print this help, then exit
  -o, --output FILE       Write format = FORMAT results to FILE
  -q, --quiet             Print less information while running
  -v, --version           Print the flickcurl version
  -V, --verbose           Print more information while running

Commands:
    auth.checkToken              TOKEN
      Get the credentials attached to an authentication TOKEN.
    auth.getFrob                 
      Get a frob to be used during authentication.
    auth.getFullToken            MINI-TOKEN
      Get the full authentication token for MINI-TOKEN.
    auth.getToken                TOKEN
      Get the auth token for the FROB, if one has been attached.
    activity.userComments        [PER-PAGE [PAGE]]
      Get photos commented on by the caller.
    activity.userPhotos          [TIMEFRAME [PER-PAGE [PAGE]]]
      Get recent activity on the caller's photos.
    blogs.getList                
      Get a list of configured blogs for the calling user.
    blogs.getServices            
      Get a list of blog services.
    blogs.postPhoto              BLOG-ID PHOTO-ID TITLE DESCRIPTION [BLOG-PASSWORD]
      Post PHOTO-ID to blog BLOG-ID with TITLE, DESCRIPTION and optional password.
    commons.getInstitutions      
      Get list of institutions
    collections.getInfo          COLLECTION-ID
      Get information on collection COLLECTION-ID
    collections.getTree          [COLLECTION-ID|- [USER-ID|-]]
      Get tree of collections COLLECTION-ID for USER-ID
    contacts.getList             [FILTER [PER-PAGE [PAGE]]]
      Get a list of contacts with optional FILTER
    contacts.getListRecentlyUploaded [DATE-LAST-UPLOAD [FILTER]]
      Get a list of recent uploading contacts since DATE-LAST-UPLOAD with optional FILTER
    favorites.add                PHOTO-ID
      Adds PHOTO-ID to the current user's favorites.
    favorites.getContext         PHOTO-ID USER-NSID [NUM-PREV [NUM-NEXT [EXTRAS]]]
      Get context photos around USER-ID's favorite PHOTO-ID.
    favorites.getList            USER-NSID [[PER-PAGE] [PAGE [FORMAT]]]
      Get a list of USER-NSID's favorite photos.
    favorites.getPublicList      USER-NSID [[PER-PAGE] [PAGE [FORMAT]]]
      Get a list of USER-NSID's favorite public photos.
    favorites.remove             PHOTO-ID
      Removes PHOTO-ID to the current user's favorites.
    galleries.addPhoto           GALLERY-ID PHOTO-ID TEXT
      Add photo PHOTO-ID to galleries GALLERY-ID with TEXT
    galleries.create             TITLE [DESCRIPTION [PRIMARY-PHOTO-ID]
      Create a new gallery with TITLE, DESCRIPTION and PRIMARY-PHOTO_ID.
    galleries.editMeta           GALLERY-ID TITLE [DESCRIPTION]
      Set the TITLE and/or DESCRIPTION of a GALLERY-ID.
    galleries.editPhoto          GALLERY-ID PHOTO-ID COMMENT
      Set the COMMENT for PHOTO-ID in GALLERY-ID.
    galleries.editPhotos         GALLERY-ID PRIMARY-PHOTO-ID PHOTO-IDS,...
      Set the PHOTO-IDs of a GALLERY-ID and PRIMARY-PHOTO-ID.
    galleries.getInfo            GALLERY-ID
      Get information about GALLERY-ID.
    galleries.getList            USER-ID [PER-PAGE [PAGE]]
      Get list of galleries for a USER-ID with optional paging
    galleries.getListForPhoto    PHOTO-ID [PER-PAGE [PAGE]]
      Get list of galleries PHOTO-ID appears in with optional paging
    galleries.getPhotos          GALLERY-ID [EXTRAS [PER-PAGE [PAGE [FORMAT]]]]
      Get the list of photos in GALLERY-ID with options.
    groups.browse                [CAT-ID]
      Browse groups below category CAT-ID (or root).
    groups.getInfo               GROUP-ID [LANG]
      Get information on group GROUP-ID with language LANG.
    groups.search                TEXT [PER-PAGE [PAGE]]
      Search for groups matching TEXT paging PER-PAGE and PAGE.
    groups.members.getList       GROUP-ID [MEMBER-TYPES [PER-PAGE [PAGE]]]
      Get list of MEMBER-TYPES types members of group GROUP-ID.
    groups.pools.add             PHOTO-ID GROUP-ID
      Add PHOTO-ID in GROUP-ID pool.
    groups.pools.getContext      PHOTO-ID GROUP-ID
      Get next and previous photos for PHOTO-ID in GROUP-ID pool.
    groups.pools.getGroups       [PAGE [PER-PAGE]]
      Get list of groups a user can add to.
    groups.pools.getPhotos       GROUP-ID [PAGE [PER-PAGE [FORMAT]]]
      Get list of photos in GROUP-ID.
    groups.pools.remove          PHOTO-ID GROUP-ID
      Remove PHOTO-ID from group GROUP-ID.
    interestingness.getList      [PARAMS]
      Get interesting photos with optional parameters
  date DATE  extras EXTRAS  per-page PER-PAGE  page PAGE  format FORMAT
    machinetags.getNamespaces    [PREDICATE [PER-PAGE [PAGE]]]
      Get a list of namespaces with optional PREDICATE
    machinetags.getPairs         [NAMESPACE [PREDICATE [PER-PAGE [PAGE]]]]
      Get a list of unique NAMESPACE and PREDICATE pairs
    machinetags.getPredicates    [NAMESPACE [PER-PAGE [PAGE]]]
      Get a list of unique predicates optionally by NAMESPACE
    machinetags.getValues        NAMESPACE PREDICATE [PER-PAGE [PAGE]]
      Get a list of unique values for a NAMESPACE and PREDICATE
    machinetags.getRecentValues  [NAMESPACE|- [PREDICATE|- [ADDED-SINCE]]]
      Get a list of recent machinetags for NAMESPACE and PREDICATE since ADDED-SINCE
    panda.getList                
      get the current list of pandas
    panda.getPhotos              PANDA
      ask a PANDA for a list of recent public and safe photos
    people.findByEmail           EMAIL
      get a user's NSID from their EMAIL address
    people.findByUsername        USERNAME
      get a user's NSID from their USERNAME
    people.getInfo               USER-NSID
      Get information about one person with id USER-NSID
    people.getPhotos             USER-NSID
      Get photos from user USER-NSID with optional parameters
  safe-search 1-3  min-upload-date DATE  max-upload-date DATE
  min-taken date DATE  max-taken-date DATE  content-type 1-7
  privacy-filter 1-5  per-page PER-PAGE  page PAGE  format FORMAT
    people.getPhotosOf           USER-NSID [PER-PAGE [PAGE [FORMAT]]]
      Get public photos of a user USER-NSID
    people.getPublicGroups       USER-NSID
      Get list of public groups a user is a member of
    people.getPublicPhotos       USER-NSID [PER-PAGE [PAGE [FORMAT]]]
      Get public photos for a user USER-NSID
    people.getUploadStatus       
      Get calling user upload status
    photos.addTags               PHOTO-ID TAGS
      Add TAGS to a PHOTO-ID.
    photos.delete                PHOTO-ID
      Delete a PHOTO-ID.
    photos.getAllContexts        PHOTO-ID
      Get all visible sets and pools the PHOTO-ID belongs to.
    photos.getContactsPhotos     
      Get a list of recent photos from the calling users' contacts
    photos.getContactsPublicPhotos USER-NSID [FORMAT]
      Get a list of recent public photos from USER-NSID's contacts
    photos.getContext            PHOTO-ID
      Get next and previous photos for a PHOTO-ID in a photostream.
    photos.getCounts             DATES TAKEN-DATES
      Get the counts for a set of DATES or TAKEN-DATES.
    photos.getExif               PHOTO-ID
      Get EXIF information about one photo with id PHOTO-ID
    photos.getFavorites          PHOTO-ID [PER-PAGE [PAGE]]
      Get favourites information about one photo with id PHOTO-ID
    photos.getInfo               PHOTO-ID
      Get information about one photo with id PHOTO-ID
    photos.getNotInSet           [PER-PAGE [PAGE [FORMAT]]]
      Get list of photos that are not in any set
    photos.getPerms              PHOTO-ID
      Get a photo viewing and commenting permissions
    photos.getRecent             [PER-PAGE [PAGE [FORMAT]]]
      Get list of recent photos
    photos.getSizes              PHOTO-ID
      Get sizes of a PHOTO-ID
    photos.getUntagged           [PER-PAGE [PAGE [FORMAT]]]
      Get list of photos that are not tagged
    photos.getWithGeoData        [PER-PAGE [PAGE [FORMAT]]]
      Get list of photos that have geo data
    photos.getWithoutGeoData     [PER-PAGE [PAGE [FORMAT]]]
      Get list of photos that do not have geo data
    photos.recentlyUpdated       MIN-DATE [PER-PAGE [PAGE [FORMAT]]]
      Get list of photos that were recently updated
    photos.removeTag             PHOTO-ID TAG-ID
      Remove a tag TAG-ID from a photo.
    photos.search                [PARAMS] tags TAGS...
      Search for photos/videos with many optional parameters
        user USER  tag-mode any|all  text TEXT
        (min|max)-(upload|taken)-date DATE
        license LICENSE  privacy PRIVACY  bbox a,b,c,d
        sort date-(posted|taken)-(asc|desc)|interestingness-(desc|asc)|relevance
        accuracy 1-16  safe-search 1-3  type 1-4
        machine-tags TAGS  machine-tag-mode any|all
        group-id ID  place-id ID  extras EXTRAS
        per-page PER-PAGE  page PAGES
        media all|photos|videos  has-geo
        lat LAT lon LON radius RADIUS radius-units km|mi
        contacts (all|ff)
        format FORMAT  woeid WOEID
        geo-context 1-2
        in-commons  in-gallery
    photos.setContentType        PHOTO-ID TYPE
      Set photo TYPE to one of 'photo', 'screenshot' or 'other'
    photos.setDates              PHOTO-ID POSTED TAKEN GRANULARITY
      Set a photo POSTED date, TAKEN date with GRANULARITY
    photos.setMeta               PHOTO-ID TITLE DESCRIPTION
      Set a photo TITLE and DESCRIPTION
    photos.setPerms              PHOTO-ID IS-PUBLIC IS-FRIEND IS-FAMILY PERM-COMMENT PERM-ADDMETA
      Set a photo viewing and commenting permissions
    photos.setSafetyLevel        PHOTO-ID SAFETY-LEVEL HIDDEN
      Set a photo's SAFETY-LEVEL and HIDDEN flag
    photos.setTags               PHOTO-ID TAGS
      Set the tags for a PHOTO-ID to TAGS.
    photos.comments.addComment   PHOTO-ID TEXT
      Add a photo comment TEXT to PHOTO-ID.
    photos.comments.deleteComment COMMENT-ID
      Delete a photo comment COMMENT-ID.
    photos.comments.editComment  COMMENT-ID TEXT
      Edit a photo comment COMMENT-ID to have new TEXT.
    photos.comments.getList      PHOTO-ID
      Get the comments for a photo PHOTO-ID.
    photos.comments.getRecentForContacts [PARAMS]
      Get the list of photos for user contacts with recent comments
      since DATE-LAST-COMMENT filter CONTACTS-FILTER
      per-page PER-PAGE page PAGE format FORMAT
    photos.geo.getLocation       PHOTO-ID
      Get the geo location for a photo PHOTO-ID.
    photos.geo.getPerms          PHOTO-ID
      Get the geo perms for a photo PHOTO-ID.
    photos.geo.removeLocation    PHOTO-ID
      Remove the location for a photo PHOTO-ID.
    photos.geo.setLocation       PHOTO-ID LAT LONG ACCURACY
      Set the location for a photo PHOTO-ID.
    photos.geo.setPerms          PHOTO-ID IS-PUBLIC IS-CONTACT IS-FRIEND IS-FAMILY
      Set the geo perms for a photo PHOTO-ID.
    photos.licenses.getInfo      
      Get list of available photo licenses
    photos.licenses.setLicense   PHOTO-ID LICENSE-ID
      Get photo PHOTO-ID license to LICENSE-ID
    photos.notes.add             PHOTO-ID X Y W H TEXT
      Add a note (X, Y, W, H, TEXT) to a photo with id PHOTO-ID
    photos.notes.delete          NOTE-ID
      Delete a note with id NOTE-ID
    photos.notes.edit            NOTE-ID X Y W H TEXT
      Edit note NOTE-ID to (X, Y, W, H, TEXT)
    photos.people.add            PHOTO-ID USER-ID X Y W H
      Mark USER-ID appearing in PHOTO-ID at (X, Y, W, H)
    photos.people.delete         PHOTO-ID USER-ID
      Mark USER-ID as not appearing in PHOTO-ID
    photos.people.deleteCoords   PHOTO-ID USER-ID
      Mark USER-ID as not appearing at coordinates in PHOTO-ID
    photos.people.editCoords     PHOTO-ID USER-ID X Y W H
      Update USER-ID appearing in PHOTO-ID to coords (X, Y, W, H)
    photos.people.getList        PHOTO-ID
      Get list of users appearing in PHOTO-ID
    photos.transform.rotate      PHOTO-ID DEGREES
      Rotate PHOTO-ID by 90/180/270 DEGREES
    photos.upload.checkTickets   TICKET-IDS...
      Get the status of upload TICKET-IDS
    photosets.addPhoto           PHOTOSET-ID PHOTO-ID
      Add PHOTO-ID to a PHOTOSET-ID.
    photosets.create             TITLE DESCRIPTION PRIMARY-PHOTO-ID
      Create a photoset with TITLE, DESCRIPTION and PRIMARY-PHOTO-ID.
    photosets.delete             PHOTOSET-ID
      Delete a photoset with PHOTOSET-ID.
    photosets.editMeta           PHOTOSET-ID TITLE DESCRIPTION
      Set the TITLE and/or DESCRIPTION of a PHOTOSET-ID.
    photosets.editPhotos         PHOTOSET-ID PRIMARY-PHOTO-ID PHOTO-IDS,...
      Set the PHOTO-IDs of a PHOTOSET-ID and PRIMARY-PHOTO-ID.
    photosets.getContext         PHOTO-ID PHOTOSET-ID
      Get next and previous photos for PHOTO-ID in PHOTOSET-ID.
    photosets.getInfo            PHOTOSET-ID
      Get information about PHOTOSET-ID.
    photosets.getList            [USER-NSID]
      Get the list of photosets for the USER-NSID.
    photosets.getPhotos          PHOTOSET-ID [EXTRAS [PRIVACY [PER-PAGE [PAGE [FORMAT]]]]]
      Get the list of photos in PHOTOSET-ID with options.
    photosets.orderSets          PHOTOSET-IDS...
      Set the order of sets PHOTOSET-IDS.
    photosets.removePhoto        PHOTOSET-ID PHOTO-ID
      Remove PHOTO-ID from PHOTOSET-ID.
    photosets.removePhotos       PHOTOSET-ID PHOTO-IDS...
      Remove PHOTO-IDS from PHOTOSET-ID.
    photosets.reorderPhotos      PHOTOSET-ID PHOTO-IDS...
      Reorder PHOTO-IDS from PHOTOSET-ID.
    photosets.setPrimaryPhoto    PHOTOSET-ID PHOTO-ID
      Set photoset PHOTOSET-ID primary photo to PHOTO-ID.
    photosets.comments.addComment PHOTOSET-ID TEXT
      Add a comment TEXT to photoset PHOTOSET-ID.
    photosets.comments.deleteComment COMMENT-ID
      Delete a photoset comment COMMENT-ID.
    photosets.comments.editComment COMMENT-ID TEXT
      Edit a photoset comment COMMENT-ID to have new TEXT.
    photosets.comments.getList   PHOTOSET-ID
      Get the comments for a photoset PHOTOSET-ID.
    places.find                  TEXT
      Find places by TEXT query.
    places.findByLatLon          LAT LON ACCURACY
      Find places by LAT and LON with ACCURACY 1-16.
    places.getChildrenWithPhotosPublic PLACE-ID|- [WOE-ID|-]
      Find child places with public photos by PLACE-ID or WOE-ID
    places.getInfo               PLACE-ID|- [WOE-ID|-]
      Find place by PLACE-ID or WOE-ID
    places.getInfoByUrl          URL
      Find place by place URL
    places.getPlaceTypes         URL
      Get a list of available place types
    places.getShapeHistory       PLACE-ID|- [WOE-ID|-]
      Get history of shapes for a place by PLACE-ID or WOE-ID
    places.getTopPlacesList      PLACE-TYPE [DATE [WOE-ID|- [PLACE-ID]]]
      Get the top 100 most geotagged places for a DATE (or yesterday).
    places.placesForBoundingBox  PLACE-TYPE MIN-LONG MIN-LAT MAX-LONG MAX-LAT
      Find user places of PLACE-TYPE in bbox.
    places.placesForContacts     PLACE-TYPE WOE-ID|- PLACE-ID|- THRESHOLD [PARAMS]
      Find top 100 unique places clustered by a given PLACE-TYPE for a
user's contacts with optional parameters
  contacts CONTACTS  min-upload MIN-UPLOAD-DATE  max-upload MAX-UPLOAD-DATE
  min-taken MIN-TAKEN-DATE  max-taken MAX-TAKEN-DATE
    places.placesForUser         PLACE-TYPE [WOE-ID] [PLACE-ID [THRESHOLD]]]
      Find user places of PLACE-TYPE.
    places.resolvePlaceId        PLACE-ID  / WOE-ID
      Find places information by PLACE-ID or WOE-ID (number).
    places.resolvePlaceURL       PLACE-URL
      Find places information by PLACE-URL.
    places.tagsForPlace          PLACE-ID|- [WOE-ID|-]
      Get tags for a place by PLACE-ID or WOE-ID with optional parameters
  min-upload MIN-UPLOAD-DATE  max-upload MAX-UPLOAD-DATE
  min-taken MIN-TAKEN-DATE  max-taken MAX-TAKEN-DATE
    prefs.getContentType         
      Get default content type preference for user.
    prefs.getGeoPerms            
      Get default privacy level for geographic info for user.
    prefs.getHidden              
      Get default hidden preference for user.
    prefs.getPrivacy             
      Get default privacy preference for user.
    prefs.getSafetyLevel         
      Get default safety level for user.
    reflection.getMethods        
      Get API methods
    reflection.getMethodInfo     NAME
      Get information about an API method NAME
    stats.getCollectionDomains   DATE [COLLECTION-ID [PER-PAGE [PAGE]]]
      Get collection domains stats
    stats.getCollectionReferrers DATE DOMAIN [COLLECTION-ID [PER-PAGE [PAGE]]]
      Get collection referrers stats
    stats.getCollectionStats     DATE COLLECTION-ID
      Get collection view count stats
    stats.getPhotoDomains        DATE [PHOTO-ID [PER-PAGE [PAGE]]]
      Get photo domains stats
    stats.getPhotoReferrers      DATE DOMAIN [PHOTO-ID [PER-PAGE [PAGE]]]
      Get photo referrers stats
    stats.getPhotoStats          DATE PHOTO-ID
      Get photo view count stats
    stats.getPhotosetDomains     DATE [PHOTOSET-ID [PER-PAGE [PAGE]]]
      Get photoset domains stats
    stats.getPhotosetReferrers   DATE DOMAIN [PHOTOSET-ID [PER-PAGE [PAGE]]]
      Get photoset referrers stats
    stats.getPhotosetStats       DATE PHOTOSET-ID
      Get photoset view count stats
    stats.getPhotostreamDomains  DATE [PER-PAGE [PAGE]]
      Get photostream domains stats
    stats.getPhotostreamReferrers DATE DOMAIN [PER-PAGE [PAGE]]
      Get photostream referrers stats
    stats.getPhotostreamStats    DATE
      Get photostream view count stats
    stats.getPopularPhotos       [DATE [SORT [PER-PAGE [PAGE [EXTRAS]]]]]
      Get popular photos stats
    stats.getTotalViews          [DATE]
      Get total stats
    tags.getClusters             TAG
      Get list of tag clusters for TAG
    tags.getHotList              [PERIOD [COUNT]]
      Get the list of hot tags for the given PERIOD (day, week)
    tags.getListPhoto            PHOTO-ID
      Get the tag list for a PHOTO-ID.
    tags.getListUser             [USER-NSID]
      Get the tag list for a USER-NSID (or current user).
    tags.getListUserPopular      [USER-NSID [COUNT]]
      Get the popular tag list for a USER-NSID (or current user).
    tags.getListUserRaw          [TAG]
      Get the raw versions of a TAG (or all tags) for the current user.
    tags.getRelated              TAG
      Get a list of tags 'related' to TAG based on clustered usage analysis.
    test.echo                    KEY VALUE
      Test echo API call; echos KEY VALUE
    test.login                   
      Test login API call: returns username
    test.null                    KEY VALUE
      Test null API call: no return
    urls.getGroup                GROUP-ID
      Get the url of the group page for GROUP-ID.
    urls.getUserPhotos           USER-NSID
      Get the url of the photo page for USER-NSID.
    urls.getUserProfile          USER-NSID
      Get the url of the profile page for USER-NSID.
    urls.lookupGroup             URL
      Get a group NSID from the URL to a group's page or photo pool.
    urls.lookupUser              URL
      Get a user NSID from the URL to a user's photo
    upload                       FILE [PARAMS...]
      Upload a photo FILE with optional parameters PARAM or PARAM VALUE
        title TITLE
        description DESC
        safety_level 'safe' (default) or 'moderate' or 'restricted'
        content_type 'photo' (default) or screenshot' or 'other'
        hidden 'public' (default) or 'hidden'
        friend
        public
        family
        tags TAGS... [must be last param]
    replace                      FILE PHOTO-ID [async]
      Replace a photo PHOTO-ID with a new FILE (async)
    shorturi                     PHOTO-ID
      Get the http://flic.kr short uri for PHOTO-ID
    getphotoid                   IMAGE-URL
      Get the photo id from a raw flickr farm IMAGE-URL

NSID is a user's Flickr ID, resembling the form 00000000@N00

A prefix of `flickr.' may be optionally given in all commands

Parameters for API calls that return lists of photos:

  EXTRAS is a comma-separated list of optional fields to return from:
    date_taken       Date item was taken
    date_upload      Date item was uploaded
    geo              Geotagging latitude, longitude and accuracy
    icon_server      Item owner icon fields
    last_update      Date item was last updated
    license          Item License 
    machine_tags     Machine tags
    media            Item Format: photo or video
    o_dims           Original item dimensions
    original_format  Original item secret and format
    owner_name       Item owner ID
    path_alias       Path alias for owner like /photos/USERNAME
    tags             Item clean tags (safe for HTML, URLs)
    url_m            URL of medium size image
    url_o            URL of original size image
    url_s            URL of small size image
    url_sq           URL of square size image
    url_t            URL of thumbnail size image
    views            Number of times item has been viewed

  FORMAT is result syntax format:
    feed-rss_100     RSS 1.0
    feed-rss_200     RSS 2.0
    feed-atom_10     Atom 1.0
    feed-georss      RSS 2.0 with GeoRSS and W3C Geo for geotagged photos
    feed-geoatom     Atom 1.0 with GeoRSS and W3C Geo for geotagged photos
    feed-geordf      RSS 1.0 with GeoRSS and W3C Geo for geotagged photos
    feed-kml         KML 2.1
    feed-kml_nl      KML 2.1 network link

  PAGE is result page number or '-' for default (1 = first page)

  PER-PAGE is photos per result page or '-' for default (10)

upload d'una foto

opció upload:

$ ./flickcurl upload
lt-flickcurl: Minimum of 1 arguments for command `upload'
  USAGE: lt-flickcurl upload FILE [PARAMS...]
Try `lt-flickcurl --help' for more information.

Quan encara no tenia ben configurat el auth_key obtenia:

$ ./flickcurl upload /home/joan/Imatges/gnuplo7_S6V6.jpg
lt-flickcurl: Uploading file /home/joan/Imatges/gnuplo7_S6V6.jpg
lt-flickcurl: ERROR: Call failed with error 99 - Insufficient permissions. Method requires write privileges; none granted.
lt-flickcurl: Command upload failed

Però ara que ja tinc ben configurat el auth_key ja puc fer upload:

$ ./flickcurl upload /home/joan/Imatges/gnuplo7_S6V6.jpg
lt-flickcurl: Uploading file /home/joan/Imatges/gnuplo7_S6V6.jpg
lt-flickcurl: Photo upload status
  Photo ID: 6849983998

i tinc una ID unívoca per a la foto.

flickcurl: compilació

Faig

$ cd ~/flickcurl-1.22/utils
$ make clean
$ make

i puc veure quines són les sentències que es necessiten per compilar el projecte. S'han instal.lat bé totes les llibreries, a mi la única cosa que m'interessa és el fitxer flickcurl.c i l'executable que es genera flickcurl:

$ rm flickcurl

En principi amb aquestes dues línies n'hi hauria d'haver prou:

gcc -DHAVE_CONFIG_H  -I../src  -I/usr/include/libxml2  -MT flickcurl-flickcurl.o -MD  -c -o flickcurl-flickcurl.o  flickcurl.c
gcc -I/usr/include/libxml2 -g -O2 -o flickcurl flickcurl-flickcurl.o  ../src/.libs/libflickcurl.so /usr/lib/libxml2.so /usr/lib/libcurl-gnutls.so

Ara faig el meu projecte en una carpeta totalment diferent i nova /home/joan/arthropoda/upload2flickr

upload2flickr

carpeta del projecte: /home/joan/arthropoda/upload2flickr

Parteixo del codi de flickcurl.c i vaig construint el meu mínim codi per poder realitzar la tasca de pujar fotos al Flickr automàticament.

gcc -DHAVE_CONFIG_H  -I../src  -I/usr/include/libxml2  -MT flickcurl-flickcurl.o -MD  -c -o upload2flickr-upload2flickr.o  upload2flickr-0.0.1.c
gcc -I/usr/include/libxml2 -g -O2 -o upload2flickr upload2flickr-upload2flickr.o  /home/joan/flickcurl-1.22/src/.libs/libflickcurl.so /usr/lib/libxml2.so /usr/lib/libcurl-gnutls.so

aquí l'únic truco és que faig referència al projecte original: /home/joan/flickcurl-1.22/src/.libs/libflickcurl.so /usr/lib/libxml2.so

grups als que pertanyo a Flickr

Aquesta informació es troba a partir del NSID, que en el meu cas és 37546322@N00. El tros de codi per saber els grups als quals pertanyo és

		char *str_grups[1];
		str_grups[1] = "37546322@N00";
		rc = command_people_getPublicGroups(fc, 1, str_grups);
		if(rc) fprintf(stderr, "%s: Command %s failed\n", program, argv[0]);

Els grups als quals pertanyo són:

Group 0
group: nsid 53702755@N00  name 'Bugs'

Group 1
group: nsid 18906610@N00  name 'INSECTS'

Group 2
group: nsid 21563296@N00  name 'Macro Photography'

Group 3
group: nsid 20585692@N00  name 'The Spider Web'

Group 4
group: nsid 33818533@N00  name 'Insect Macro Photography'

Group 5
group: nsid 41324459@N00  name 'Insect Photography'

Group 6
group: nsid 98439285@N00  name 'Insects and Spiders'

Group 7
group: nsid 41069537@N00  name 'Canon EF-100mm f/2.8 Macro USM'

Group 8
group: nsid 729073@N22  name 'ALL ABOUT INSECTS & SPIDERS  (Only CLOSE, CLEAR, DETAILED)'

Group 9
group: nsid 696812@N20  name 'Insect Identification Help Group'

Group 10
group: nsid 1592620@N22  name 'Entomology, Arachnology and Environment'

creat per Joan Quintana Compte, març 2012

Eines de l'usuari
Espais de noms
Variants
Accions
Navegació
IES Jaume Balmes
Màquines recreatives
CNC
Informàtica musical
joanillo.org Planet
Eines