| Net-DPAP-Client documentation | Contained in the Net-DPAP-Client distribution. |
Net::DPAP::Client::Image - Remote DPAP image
This module represents a remote iPhoto shared image.
This returns the aspect ratio of the image.
This returns the creation date of the image as a UNIX timestamp.
This returns the internal iPhoto ID for the image. You probably don't need to worry about this.
This returns the filename of the image.
This returns the kind of file of the image. Currently an incomprehensible number.
This returns the name of the image.
This returns the URL of the image thumbnail.
This returns the thumbnail binary.
This returns the URL of the image hires.
This returns the hires binary.
Leon Brocard <acme@astray.com>
Copyright (C) 2004-6, Leon Brocard
This module is free software; you can redistribute it or modify it under the same terms as Perl itself.
| Net-DPAP-Client documentation | Contained in the Net-DPAP-Client distribution. |
package Net::DPAP::Client::Image; use strict; use warnings; use base qw(Class::Accessor::Fast); use Carp::Assert; use Net::DAAP::DMAP qw(:all); __PACKAGE__->mk_accessors(qw(ua kind id name aspectratio creationdate imagefilename thumbnail_url hires_url)); sub thumbnail { my $self = shift; my $ua = $self->ua; my $url = $self->thumbnail_url; return $self->_decode($ua->get($url)->content); } sub hires { my $self = shift; my $ua = $self->ua; my $url = $self->hires_url; return $self->_decode($ua->get($url)->content); } sub _decode { my $self = shift; my $data = shift; my $dmap = dmap_unpack($data); assert($dmap->[0]->[0] eq 'daap.databasesongs'); foreach my $tuple (@{$dmap->[0]->[1]}) { my $key = $tuple->[0]; my $value = $tuple->[1]; assert($value == 200) if $key eq 'dmap.status'; next unless $key eq 'dmap.listing'; my $list = $value->[0]->[1]; foreach my $subtuple (@$list) { my $subsubkey = $subtuple->[0]; my $subsubvalue = $subtuple->[1]; return $subsubvalue if $subsubkey eq 'dpap.picturedata'; } } } 1; __END__