Ignore:
Timestamp:
2021-02-26T19:39:51+13:00 (3 years ago)
Author:
anupama
Message:

Committing the improvements to EmbeddedMetaPlugin's processing of Keywords vs other metadata fields. Keywords were literally stored as arrays of words rather than phrases in PDFs (at least in Diego's sample PDF), whereas other meta fields like Subjects and Creators stored them as arrays of phrases. To get both to work, Kathy updated EXIF to a newer version, to retrieve the actual EXIF values stored in the PDF. And Kathy and Dr Bainbridge came up with a new option that I added called apply_join_before_split_to_metafields that's a regex which can list the metadata fields to apply the join_before_split to and whcih previously always got applied to all metadata fields. Now it's applied to any *Keywords metafields by default, as that's the metafield we have experience of that behaves differently to the others, as it stores by word instead of phrases. Tested on Diego's sample PDF. Diego has double-checked it to works on his sample PDF too, setting the split char to ; and turning on the join_before_split and leaving apply_join_before_split_to_metafields at its default of .*Keywords. File changes are strings.properties for the tooltip, the plugin introducing the option and working with it and Kathy's EXIF updates affecting cpan/File and cpan/Image.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/cpan/Image/ExifTool/FotoStation.pm

    r24107 r34921  
    1313use Image::ExifTool qw(:DataAccess :Utils);
    1414
    15 $VERSION = '1.00';
     15$VERSION = '1.04';
    1616
    1717sub ProcessFotoStation($$);
     
    3939    0x03 => {
    4040        Name => 'ThumbnailImage',
     41        Groups => { 2 => 'Preview' },
    4142        Writable => 1,
    4243        RawConv => '$self->ValidateImage(\$val,$tag)',
     
    4445    0x04 => {
    4546        Name => 'PreviewImage',
     47        Groups => { 2 => 'Preview' },
    4648        Writable => 1,
    4749        RawConv => '$self->ValidateImage(\$val,$tag)',
     
    119121sub ProcessFotoStation($$)
    120122{
    121     my ($exifTool, $dirInfo) = @_;
    122     $exifTool or return 1;    # allow dummy access to autoload this package
     123    my ($et, $dirInfo) = @_;
     124    $et or return 1;    # allow dummy access to autoload this package
    123125    my ($buff, $footer, $dirBuff, $tagTablePtr);
    124126    my $raf = $$dirInfo{RAF};
    125127    my $outfile = $$dirInfo{OutFile};
    126128    my $offset = $$dirInfo{Offset} || 0;
    127     my $verbose = $exifTool->Options('Verbose');
    128     my $out = $exifTool->Options('TextOut');
     129    my $verbose = $et->Options('Verbose');
     130    my $out = $et->Options('TextOut');
    129131    my $rtnVal = 0;
    130132
     
    152154        unless ($outfile) {
    153155            # print verbose trailer information
    154             if ($verbose or $exifTool->{HTML_DUMP}) {
    155                 $exifTool->DumpTrailer({
     156            if ($verbose or $$et{HTML_DUMP}) {
     157                $et->DumpTrailer({
    156158                    RAF => $raf,
    157159                    DataPos => $$dirInfo{DataPos},
     
    161163            }
    162164            # extract information for this tag
    163             $exifTool->HandleTag($tagTablePtr, $tag, $buff,
    164                                  DataPt => \$buff,
    165                                  Start => 0,
    166                                  Size => $size,
    167                                  DataPos => $$dirInfo{DataPos});
     165            $et->HandleTag($tagTablePtr, $tag, $buff,
     166                DataPt => \$buff,
     167                Start => 0,
     168                Size => $size,
     169                DataPos => $$dirInfo{DataPos},
     170            );
    168171            next;
    169172        }
    170         if ($exifTool->{DEL_GROUP}->{FotoStation}) {
    171             $verbose and printf $out "  Deleting FotoStation trailer\n";
     173        if ($$et{DEL_GROUP}{FotoStation}) {
     174            $verbose and print $out "  Deleting FotoStation trailer\n";
    172175            $verbose = 0;   # no more verbose messages after this
    173             ++$exifTool->{CHANGED};
     176            ++$$et{CHANGED};
    174177            next;
    175178        }
    176179        # rewrite this information
    177         my $tagInfo = $exifTool->GetTagInfo($tagTablePtr, $tag);
     180        my $tagInfo = $et->GetTagInfo($tagTablePtr, $tag);
    178181        if ($tagInfo) {
    179182            my $newVal;
     
    189192                );
    190193                my $subTable = GetTagTable($tagInfo->{SubDirectory}->{TagTable});
    191                 $newVal = $exifTool->WriteDirectory(\%subdirInfo, $subTable);
     194                $newVal = $et->WriteDirectory(\%subdirInfo, $subTable);
    192195            } else {
    193                 my $nvHash = $exifTool->GetNewValueHash($tagInfo);
    194                 if (Image::ExifTool::IsOverwriting($nvHash) > 0) {
    195                     $newVal = Image::ExifTool::GetNewValues($nvHash);
     196                my $nvHash = $et->GetNewValueHash($tagInfo);
     197                if ($et->IsOverwriting($nvHash) > 0) {
     198                    $newVal = $et->GetNewValue($nvHash);
    196199                    $newVal = '' unless defined $newVal;
    197200                    if ($verbose > 1) {
     
    200203                        print $out "    + FotoStation:$tagName ($n bytes)\n" if $n;
    201204                    }
    202                     ++$exifTool->{CHANGED};
     205                    ++$$et{CHANGED};
    203206                }
    204207            }
     
    241244=head1 AUTHOR
    242245
    243 Copyright 2003-2011, Phil Harvey (phil at owl.phy.queensu.ca)
     246Copyright 2003-2021, Phil Harvey (philharvey66 at gmail.com)
    244247
    245248This library is free software; you can redistribute it and/or modify it
Note: See TracChangeset for help on using the changeset viewer.