Changeset 10

Show
Ignore:
Timestamp:
02/07/07 23:59:21 (2 years ago)
Author:
simon
Message:

Read tags from Exif/IPTC. Closes #2.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Memories/Photo.pm

    r9 r10  
    5555 
    5656    $photo->make_thumb; 
     57    $r->{params}{tags} ||= join " ", map { qq{"$_"} } $photo->tags_exif; 
    5758    $photo->add_tags($r->{params}{tags}); 
    5859    $photo->add_to_imageseek_library; 
     
    319320sub license { shift->_grovel_metadata( 'Rights Usage Terms', 'Usage Terms' ) } 
    320321sub copyright { shift->_grovel_metadata( 'Rights', 'Copyright', 'Copyright Notice') } 
     322 
     323# This one's slightly different since we want everything we can get... 
     324sub tags_exif { 
     325    my $self = shift; 
     326    my %md = map {%$_} values %{$self->exif_info}; 
     327    my %tags =  
     328        map { s/\s+/-/g; lc $_ => 1  } 
     329        map { split /\s*,\s*/, $md{$_}} 
     330        grep {$md{$_} and $md{$_} =~/[^ 0:]/} 
     331        (qw(Keywords Subject City State Location Country Province-State),  
     332        'Transmission Reference', 'Intellectual Genre',  
     333        'Country-Primary Location Name' 
     334        ); 
     335    return keys %tags; 
     336} 
    3213371;