Flickr-Upload

 view release on metacpan or  search on metacpan

flickr_upload  view on Meta::CPAN

}

exit 0;

sub response_tag {
	my $t = shift;
	my $name = shift;
	my $tag = shift;

	return undef unless defined $t and exists $t->{'children'};

	for my $n ( @{$t->{'children'}} ) {
		next unless $n->{'name'} eq $name;
		next unless exists $n->{'children'};

		for my $m (@{$n->{'children'}} ) {
			next unless exists $m->{'name'}
				and $m->{'name'} eq $tag
				and exists $m->{'children'};

			return $m->{'children'}->[0]->{'content'};
		}
	}
	return undef;
}

sub getFrob {
	my $ua = shift;

	my $res = $ua->execute_method("flickr.auth.getFrob");
	return undef unless defined $res and $res->{success};

	# FIXME: error checking, please. At least look for the node named 'frob'.
	return $res->{tree}->{children}->[1]->{children}->[0]->{content};
}

sub getToken {
	my $ua = shift;
	my $frob = shift;

	my $res = $ua->execute_method("flickr.auth.getToken",
		{ 'frob' => $frob } );
	return undef unless defined $res and $res->{success};

	# FIXME: error checking, please.
	return $res->{tree}->{children}->[1]->{children}->[1]->{children}->[0]->{content};
}

sub checkToken {
	my $ua = shift;
	my $key = shift;
	my $token = shift;

	my $res = $ua->execute_method("flickr.auth.checkToken",
		{
			'auth_token' => $token,
			'api_key' => $key,
		} );

	# FIXME: this could be parsed, but I'm not going to get too fancy
	print $res->decoded_content();

	return 0;
}

__END__

=head1 NAME

flickr_upload - Upload photos to C<flickr.com>

=head1 SYNOPSIS

flickr_upload [--auth] --auth_token <auth_token> [--title <title>]
	[--description description] [--public <0|1>] [--friend <0|1>]
	[--family <0|1>] [--tag <tag>] [--option key=value] [--progress]
    <photos...>

=head1 DESCRIPTION

Batch image uploader for the L<Flickr.com> service.

L<flickr_upload> may also be useful for generating authentication tokens
against other API keys/secrets (i.e. for embedding in scripts).

=head1 OPTIONS

=over 4

=item --auth

The C<--auth> flag will cause L<flickr_upload> to generate an
authentication token against it's API key and secret (or, if you want,
your own specific key and secret).  This process requires the caller
to have a browser handy so they can cut and paste a url. The resulting
token should be kept somewhere like C<~/.flickrrc> since it's necessary
for actually uploading images.

=item --auth_token <auth_token>

Authentication token. You B<must> get an authentication token using
C<--auth> before you can upload images. See the L<EXAMPLES> section.

=item --oauth

Interactively perform OAuth authorization with Flickr. The user will get a URL to visit at Flickr at which Flickr::Upload must be granted write permissions. After granting permission, the user will be redirected to a dummy URL that contains an OAuth ...

=item --title <title>

Title to use on all the images. Optional.

=item --description <description>

Description to use on all the images. Optional.

=item --public <0|1>

Override the default C<is_public> access control. Optional.

=item --friend <0|1>



( run in 0.730 second using v1.01-cache-2.11-cpan-39bf76dae61 )