- my $self = shift;
- my $exif = $self->exif_info->{EXIF};
- my ($dt) =
- grep {$_ and /[^ 0:]/}
- ($exif->{ 'Shooting Date/Time' },
- $exif->{ 'Date/Time Of Digitization' },
- $exif->{ 'Date/Time Of Last Modification' });
- if (!$dt) { return $self->uploaded }
- return Time::Piece->strptime($dt, "%Y:%m:%d %T") || $self->uploaded;
+ my $self = shift;
+ my $dt = $self->_grovel_metadata(
+ 'Shooting Date/Time',
+ 'Date/Time Of Digitization',
+ 'Date/Time Of Last Modification'
+ );
+ if (!$dt) { return $self->uploaded }
+ return Time::Piece->strptime($dt, "%Y:%m:%d %T") || $self->uploaded;
+}
+
+sub description {
+ shift->_grovel_metadata(
+ 'Description', 'Image Description', 'Caption-Abstract'
+ );
+}
+
+sub title_exif { shift->_grovel_metadata( 'Headline', 'Title'); }
+sub license { shift->_grovel_metadata( 'Rights Usage Terms', 'Usage Terms' ) }
+sub copyright { shift->_grovel_metadata( 'Rights', 'Copyright', 'Copyright Notice') }
+
+# This one's slightly different since we want everything we can get...
+sub tags_exif {
+ my $self = shift;
+ my %md = map {%$_} values %{$self->exif_info};
+ my %tags =
+ map { s/\s+/-/g; lc $_ => 1 }
+ map { split /\s*,\s*/, $md{$_}}
+ grep {$md{$_} and $md{$_} =~/[^ 0:]/}
+ (qw(Keywords Subject City State Location Country Province-State),
+ 'Transmission Reference', 'Intellectual Genre',
+ 'Country-Primary Location Name'
+ );
+ return keys %tags;