| 1 | use strict; | ||
| 2 | use warnings; | ||
| 3 | |||
| 4 | package Net::Google::PicasaWeb::MediaEntry; | ||
| 5 | use Moose; | ||
| 6 | |||
| 7 | extends 'Net::Google::PicasaWeb::MediaFeed'; | ||
| 8 | |||
| 9 | =head1 NAME | ||
| 10 | |||
| 11 | Net::Google::PicasaWeb::MediaEntry - represents a single Picasa Web photo or video | ||
| 12 | |||
| 13 | =head1 SYNOPSIS | ||
| 14 | |||
| 15 | my @photos = $album->list_photos; | ||
| 16 | for my $photo (@photos) { | ||
| 17 | print "Title: ", $photo->title, "\n"; | ||
| 18 | print "Summary: ", $photo->summary, "\n"; | ||
| 19 | print "Author: ", $photo->author_name, " (", $photo->author_uri, ")\n"; | ||
| 20 | |||
| 21 | $photo->fetch_content( file => 'photo.jpg' ); | ||
| 22 | } | ||
| 23 | |||
| 24 | =head1 DESCRIPTION | ||
| 25 | |||
| 26 | Represents an individual Picasa Web photo. | ||
| 27 | |||
| 28 | =head1 ATTRIBUTES | ||
| 29 | |||
| 30 | =head2 title | ||
| 31 | |||
| 32 | This is the title of the photo. | ||
| 33 | |||
| 34 | =head2 summary | ||
| 35 | |||
| 36 | This is the summary description of the photo. | ||
| 37 | |||
| 38 | =head2 author_name | ||
| 39 | |||
| 40 | This is the author/owner of the photo. | ||
| 41 | |||
| 42 | =head2 author_uri | ||
| 43 | |||
| 44 | This is the URL to get to the author's public albums on Picasa Web. | ||
| 45 | |||
| 46 | =head2 photo | ||
| 47 | |||
| 48 | This is a link to the L<Net::Google::PicasaWeb::Media> object that is used to reference the photo itself and its thumbnails. | ||
| 49 | |||
| 50 | =head2 album_id | ||
| 51 | |||
| 52 | This is the ID of the album that the photo belongs to. | ||
| 53 | |||
| 54 | =cut | ||
| 55 | |||
| 56 | has album_id => ( | ||
| 57 | is => 'rw', | ||
| 58 | isa => 'Str', | ||
| 59 | ); | ||
| 60 | |||
| 61 | =head1 METHODS | ||
| 62 | |||
| 63 | =cut | ||
| 64 | |||
| 65 | override from_feed => sub { | ||
| 66 | my ($class, $service, $entry) = @_; | ||
| 67 | my $self = $class->super($service, $entry); | ||
| 68 | |||
| 69 | $self->album_id($entry->field('gphoto:albumid')); | ||
| 70 | return $self; | ||
| 71 | }; | ||
| 72 | |||
| 73 | =head2 list_tags | ||
| 74 | |||
| 75 | Lists tags used in the albums. | ||
| 76 | |||
| 77 | This method takes the L<Net::Google::PicasaWeb/STANDARD LIST OPTIONS>. | ||
| 78 | |||
| 79 | =cut | ||
| 80 | |||
| 81 | sub list_tags { | ||
| 82 | my ($self, %params) = @_; | ||
| 83 | $params{kind} = 'tag'; | ||
| 84 | |||
| 85 | return $self->service->list_entries( | ||
| 86 | 'Net::Google::PicasaWeb::Tag', | ||
| 87 | $self->url, | ||
| 88 | %params | ||
| 89 | ); | ||
| 90 | } | ||
| 91 | |||
| 92 | =head2 list_comments | ||
| 93 | |||
| 94 | Lists comments used in the albums. | ||
| 95 | |||
| 96 | This method takes the L<Net::Google::PicasaWeb/STANDARD LIST OPTIONS>. | ||
| 97 | |||
| 98 | =cut | ||
| 99 | |||
| 100 | sub list_comments { | ||
| 101 | my ($self, %params) = @_; | ||
| 102 | $params{kind} = 'comment'; | ||
| 103 | |||
| 104 | return $self->service->list_entries( | ||
| 105 | 'Net::Google::PicasaWeb::Comment', | ||
| 106 | $self->url, | ||
| 107 | %params | ||
| 108 | ); | ||
| 109 | } | ||
| 110 | |||
| 111 | =head1 AUTHOR | ||
| 112 | |||
| 113 | Andrew Sterling Hanenkamp, C<< <hanenkamp at cpan.org> >> | ||
| 114 | |||
| 115 | =head1 COPYRIGHT & LICENSE | ||
| 116 | |||
| 117 | Copyright 2008 Andrew Sterling Hanenkamp | ||
| 118 | |||
| 119 | This program is free software; you can redistribute it and/or modify it | ||
| 120 | under the same terms as Perl itself. | ||
| 121 | |||
| 122 | =cut | ||
| 123 | |||
| 124 | 1; |