Net::Google::PicasaWeb - use Google's Picasa Web API
version 0.12
use Net::Google::PicasaWeb; my $service = Net::Google::PicasaWeb->new; # Login via one of these $service->login('jondoe@gmail.com', 'north23AZ'); # Working with albums (see Net::Google::PicasaWeb::Album) my @albums = $service->list_albums( user_id => 'jondoe'); $album->title('Quick Trip To Italy'); # Listing photos (see Net::Google::PicasaWeb::MediaEntry) my @photos = $album->list_media_entries; my @recent = $album->list_media_entries( max_results => 10 ); my @puppies = $album->list_media_entries( q => 'puppies' ); my @all_puppies = $service->list_media_entries( q => 'puppies' ); # Updating/Deleting photos (or video) $photo->title('Plz to love RealCat'); # Listing tags my @user_tags = $service->list_tags( user_id => 'jondoe' ); my @album_tags = $album->list_tags; my @photo_tags = $photo->list_tags; # Listing comments (see Net::Google::PicasaWeb::Comment) my @recent = $service->list_comments( user_id => 'jondoe', max_results => 10 ); my @photo_comments = $photo->list_comments;
This module uses Moose to handle attributes and such. These attributes are readable, writable, and may be passed to the constructor unless otherwise noted.
This is an Net::Google::AuthSub object used to handle authentication. The default is an instance set to use a service of "lh2" and a source of "Net::Google::PicasaWeb-VERSION".
This is an LWP::UserAgent object used to handle web communication.
This is the base URL of the API to contact. This should probably always be http://picasaweb.google.com/data/feed/api/ unless Google starts providing alternate URLs or someone has a service providing the same API elsewhere..
http://picasaweb.google.com/data/feed/api/
When parsing the Google Data API response, these are the namespaces that will be used. By default, this is defined as:
{ 'http://search.yahoo.com/mrss/' => 'media', 'http://schemas.google.com/photos/2007' => 'gphoto', 'http://www.georss.org/georss' => 'georss', 'http://www.opengis.net/gml' => 'gml', }
You may add more namespaces to this list, if needed.
my $service = Net::Google::PicasaWeb->new(%params);
See the "ATTRIBUTES" section for a list of possible parameters.
my $success = $service->login($username, $password, %options);
This is a shortcut for performing:
$service->authenticator->login($username, $password, %options);
It has some additional error handling. This method will return a true value on success or die on error.
See Net::Google::AuthSub.
my @albums = $service->list_albums(%params);
This will list a set of albums available from Picasa Web Albums. If no %params are set, then this will list the albums belonging to the authenticated user. If the user is not authenticated, this will probably not return anything. Further control is gained by specifying one or more of the following parameters:
%params
This is the user ID to request a list of albums from. The defaults to "default", which lists those belonging to the current authenticated user.
This method also takes the "STANDARD LIST OPTIONS".
my $album = $service->get_album( user_id => 'hanenkamp', album_id => '5143195220258642177', );
This will fetch a single album from the Picasa Web Albums using the given user_id and album_id. If user_id is omitted, then "default" will be used instead.
user_id
album_id
This method returns undef if no such album exists.
undef
Create a new album for the current authenticated user.
my $album = $service->add_album( title => 'Trip to Italy', summary => 'This was the recent trip I took to Italy', location => 'Italy', access => 'public', commentingEnabled => 'true', timestamp => '1152255600000', keywords => ('italy', 'vacation'), );
The title of a new album.
A small description of the album.
The location of the place where the photos have been taken.
The type of access to this album. It could be public or private.
public
private
The default values will be applied by PicasaWeb on the server side.
See http://code.google.com/intl/en-US/apis/picasaweb/developers_guide_protocol.html#AddAlbums for details.
http://code.google.com/intl/en-US/apis/picasaweb/developers_guide_protocol.html#AddAlbums
Returns a list of tags that have been used by the logged user or the user named in the user_id parameter.
This method accepts this parameters:
The ID of the user to find tags for. Defaults to the current user.
This method also takes all the "STANDARD LIST OPTIONS".
Returns comments on photos for the current account or the account given by the user_id parameter.
It accepts the following parameters:
This is the ID of the user to search for comments within. The comments returned will be commons on photos owned by this user. The default is to search the comments of the authenticated user.
This method also accepts the "STANDARD LIST OPTIONS".
my $comment = $service->get_comment( user_id => $user_id, album_id => $album_id, photo_id => $photo_id, comment_id => $comment_id, );
Retrieves a single comment from Picasa Web via the given user_id, album_id, photo_id, and comment_id. If user_id is not given, "default" will be used.
photo_id
comment_id
Returns undef if no matching comment is found.
Returns photos and videos based on the query options given. If a user_id option is set, the photos returned will be those related to the named user ID. Without a user ID, the photos will be pulled from the general community feed.
If given, the photos will be limited to those owned by this user. If it is set to "default", then the authenticated user will be used. If no user_id is set, then the community feed will be used rather than a specific user. This option may not be combined with featured.
featured
This can be set to a true value to fetch the current featured photos on PicasaWeb. This option is not compatible with user_id.
The "list_photos" and "list_videos" methods are synonyms for "list_media_entries".
my $media_entry = $service->get_media_entry( user_id => $user_id, album_id => $album_id, photo_id => $photo_id, );
Returns a specific photo or video entry when given a user_id, album_id, and photo_id. If user_id is not given, "default" will be used.
If no such photo or video can be found, undef will be returned.
my $media_entry = $service->add_media_entry( user_id => $user_id, album_id => $album_id, title => $title, summary => $summary, keywords => ($keyword, $keyword, ), data => $binary, data_type => $content_type, );
These helper methods are used to do some of the work.
my $response = $service->request($method, $path, $query, $content);
This handles the details of making a request to the Google Picasa Web API.
my $entry = $service->get_entry($class, $path, %params);
This is used by the get_* methods to pull and initialize a single object from Picasa Web.
get_*
my @entries = $service->list_entries($class, $path, %params);
This is used by the list_* methods to pull and initialize lists of objects from feeds.
list_*
Several of the listing methods return entries that can be modified by setting the following options.
This is the visibility value to limit the returned results to.
This option is only used when listing albums and photos or videos.
By passing a single scalar or an array reference of scalars, e.g.,
thumbsize => '72c', thumbsize => [ qw( 104c 640u d ) ], thumbsize => '1440u,1280u',
You may select the size or sizes of thumbnails attached to the items returned. Please see the parameters documentation for a description of valid values.
This is a single scalar selecting the size of the main image to return with the items found. Please see the parameters documentation for a description of valid values.
This is a tag name to use to filter the items returned.
This is a full-text query string to filter the items returned.
This is the maximum number of results to be returned.
This is the 1-based index of the first result to be returned.
This is the bounding box of geo coordinates to search for items within. The coordinates are given as an array reference of exactly 4 values given in the following order: west, south, east, north.
This may be set to the name of a geo location to search for items within. For example, "London".
Please report any bugs or feature requests to bug-Net-Google-PicasaWeb at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Net-Google-PicasaWeb. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-Net-Google-PicasaWeb at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc Net::Google::PicasaWeb
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-Google-PicasaWeb
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Net-Google-PicasaWeb
CPAN Ratings
http://cpanratings.perl.org/d/Net-Google-PicasaWeb
Search CPAN
http://search.cpan.org/dist/Net-Google-PicasaWeb
Authors:
Sterling Hanenkamp (zostay)
Andy Shevchenko (andy-shev)
Benjamin Thomas (bth0mas)
Tomáš Znamenáček (zoul)
Thanks to:
Robert May for responding to email messages quickly and transfering ownership of the Net::Google::PicasaWeb namespace and providing some sample code to examine.
Net::Google::PicasaWeb
Simon Wistow for Net::Google::AuthSub, which took care of all the authentication details.
Andrew Sterling Hanenkamp <hanenkamp@cpan.org>
This software is copyright (c) 2013 by Andrew Sterling Hanenkamp.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Net::Google::PicasaWeb, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::Google::PicasaWeb
CPAN shell
perl -MCPAN -e shell install Net::Google::PicasaWeb
For more information on module installation, please visit the detailed CPAN module installation guide.