# Album Plugin:	captions/exif/exiftool
# For info:	'album -plugin_info captions/exif/exiftool'
# For usage:	'album -plugin_usage captions/exif/exiftool'
use strict;

sub start_plugin {
  my ($opt,$plugin,$path) = @_;

  # Setup my hooks
  album::hook($opt,'get_exif_info',\&get_exif_info);

  # Get the Image::ExifTool library
  my $dir = $path;
  $dir =~ s/\.alp$//g;
  push(@INC,"$dir/lib");
  require Image::ExifTool;

  return {
    author => 'David Ljung Madison',
    href => 'http://MarginalHacks.com/',
    version => '1.0',
    description =>
"Alternate method of getting exif info using exiftool,
can also read IPTC metadata

Uses: Image::ExifTool package (not in CPAN)
See:  http://www.sno.phy.queensu.ca/~phil/exiftool/

This is useful for Windows users that may have problems with jhead.
",
  };
}

sub get_exif_info {
  my ($opt, $data, $hookname, $pic) = @_;

  # We probably don't need to regen new HTML everytime we get exif info,
  # presumably what we return here is static for each image.
  #album::new_html($opt,$data,$pic);

  # It's already the hash we want!  :)
  Image::ExifTool::ImageInfo($pic);
}

# Plugins always end with:
1;
