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/AFCP.pm

    r24107 r34921  
    66# Revisions:    12/26/2005 - P. Harvey Created
    77#
    8 # References:   1) http://www.tocarte.com/media/axs_afcp_spec.pdf
     8# References:   1) http://web.archive.org/web/20080828211305/http://www.tocarte.com/media/axs_afcp_spec.pdf
    99#------------------------------------------------------------------------------
    1010
     
    1515use Image::ExifTool qw(:DataAccess :Utils);
    1616
    17 $VERSION = '1.04';
     17$VERSION = '1.08';
    1818
    1919sub ProcessAFCP($$);
     
    2929ExifTool will read and write (but not create) AFCP IPTC information in JPEG
    3030and TIFF images.
     31
     32See
     33L<http://web.archive.org/web/20080828211305/http://www.tocarte.com/media/axs_afcp_spec.pdf>
     34for the AFCP specification.
    3135    },
    3236    IPTC => { SubDirectory => { TagTable => 'Image::ExifTool::IPTC::Main' } },
     
    3438    Nail => {
    3539        Name => 'ThumbnailImage',
     40        Groups => { 2 => 'Preview' },
    3641        # (the specification allows for a variable amount of padding before
    3742        #  the image after a 10-byte header, so look for the JPEG SOI marker,
     
    4651    PrVw => {
    4752        Name => 'PreviewImage',
     53        Groups => { 2 => 'Preview' },
    4854        RawConv => q{
    4955            pos($val) = 10;
     
    6672sub ProcessAFCP($$)
    6773{
    68     my ($exifTool, $dirInfo) = @_;
     74    my ($et, $dirInfo) = @_;
    6975    my $raf = $$dirInfo{RAF};
    7076    my $curPos = $raf->Tell();
     
    116122
    117123        $rtnVal = 1;
    118         my $verbose = $exifTool->Options('Verbose');
    119         my $out = $exifTool->Options('TextOut');
     124        my $verbose = $et->Options('Verbose');
     125        my $out = $et->Options('TextOut');
    120126        my $outfile = $$dirInfo{OutFile};
    121127        if ($outfile) {
    122128            # allow all AFCP information to be deleted
    123             if ($exifTool->{DEL_GROUP}->{AFCP}) {
     129            if ($$et{DEL_GROUP}{AFCP}) {
    124130                $verbose and print $out "  Deleting AFCP\n";
    125                 ++$exifTool->{CHANGED};
     131                ++$$et{CHANGED};
    126132                last;
    127133            }
     
    132138            $vers = substr($buff, 4, 2); # get version number
    133139        } else {
    134             $exifTool->DumpTrailer($dirInfo) if $verbose or $exifTool->{HTML_DUMP};
     140            $et->DumpTrailer($dirInfo) if $verbose or $$et{HTML_DUMP};
    135141        }
    136142        # read AFCP directory data
     
    138144        my $dir;
    139145        unless ($raf->Read($dir, 12 * $numEntries) == 12 * $numEntries) {
    140             $exifTool->Error('Error reading AFCP directory', 1);
     146            $et->Error('Error reading AFCP directory', 1);
    141147            last;
    142148        }
     
    144150            my $dat = $buff . $dir;
    145151            print $out "  AFCP Directory:\n";
    146             Image::ExifTool::HexDump(\$dat, undef,
    147                 Addr   => $$dirInfo{DataPos},
    148                 Width  => 12,
    149                 Prefix => $exifTool->{INDENT},
    150                 Out => $out,
    151             );
    152         }
    153         $fix and $exifTool->Warn("Adjusted AFCP offsets by $fix", 1);
     152            $et->VerboseDump(\$dat, Addr => $$dirInfo{DataPos}, Width  => 12);
     153        }
     154        $fix and $et->Warn("Adjusted AFCP offsets by $fix", 1);
    154155#
    155156# process AFCP directory
     
    168169                if ($outfile) {
    169170                    # rewrite this information
    170                     my $tagInfo = $exifTool->GetTagInfo($tagTablePtr, $tag);
     171                    my $tagInfo = $et->GetTagInfo($tagTablePtr, $tag);
    171172                    if ($tagInfo and $$tagInfo{SubDirectory}) {
    172173                        my %subdirInfo = (
     
    178179                        );
    179180                        my $subTable = GetTagTable($tagInfo->{SubDirectory}->{TagTable});
    180                         my $newDir = $exifTool->WriteDirectory(\%subdirInfo, $subTable);
     181                        my $newDir = $et->WriteDirectory(\%subdirInfo, $subTable);
    181182                        if (defined $newDir) {
    182183                            $size = length $newDir;
     
    189190                } else {
    190191                    # extract information
    191                     $exifTool->HandleTag($tagTablePtr, $tag, $buff,
     192                    $et->HandleTag($tagTablePtr, $tag, $buff,
    192193                        DataPt => \$buff,
    193194                        Size => $size,
     
    197198                }
    198199            } else {
    199                 $exifTool->Warn("Bad AFCP directory");
     200                $et->Warn("Bad AFCP directory");
    200201                $rtnVal = -1 if $outfile;
    201202                last;
     
    259260=head1 AUTHOR
    260261
    261 Copyright 2003-2011, Phil Harvey (phil at owl.phy.queensu.ca)
     262Copyright 2003-2021, Phil Harvey (philharvey66 at gmail.com)
    262263
    263264This library is free software; you can redistribute it and/or modify it
Note: See TracChangeset for help on using the changeset viewer.