exiftool_vendored 12.82.0 → 12.85.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/bin/Changes +59 -0
  3. data/bin/MANIFEST +2 -18
  4. data/bin/META.json +1 -1
  5. data/bin/META.yml +1 -1
  6. data/bin/README +47 -46
  7. data/bin/build_geolocation +945 -0
  8. data/bin/config_files/example.config +2 -2
  9. data/bin/exiftool +75 -51
  10. data/bin/fmt_files/gpx.fmt +2 -1
  11. data/bin/fmt_files/gpx_wpt.fmt +2 -1
  12. data/bin/lib/Image/ExifTool/Apple.pm +52 -7
  13. data/bin/lib/Image/ExifTool/BuildTagLookup.pm +5 -2
  14. data/bin/lib/Image/ExifTool/Canon.pm +11 -2
  15. data/bin/lib/Image/ExifTool/CanonVRD.pm +18 -5
  16. data/bin/lib/Image/ExifTool/DJI.pm +29 -0
  17. data/bin/lib/Image/ExifTool/DPX.pm +3 -3
  18. data/bin/lib/Image/ExifTool/Exif.pm +19 -2
  19. data/bin/lib/Image/ExifTool/GM.pm +17 -8
  20. data/bin/lib/Image/ExifTool/Geolocation.dat +0 -0
  21. data/bin/lib/Image/ExifTool/Geolocation.pm +170 -104
  22. data/bin/lib/Image/ExifTool/Geotag.pm +18 -10
  23. data/bin/lib/Image/ExifTool/ID3.pm +28 -6
  24. data/bin/lib/Image/ExifTool/Nikon.pm +25 -6
  25. data/bin/lib/Image/ExifTool/Pentax.pm +64 -13
  26. data/bin/lib/Image/ExifTool/QuickTime.pm +26 -7
  27. data/bin/lib/Image/ExifTool/QuickTimeStream.pl +5 -0
  28. data/bin/lib/Image/ExifTool/Sony.pm +15 -6
  29. data/bin/lib/Image/ExifTool/TagLookup.pm +3557 -3540
  30. data/bin/lib/Image/ExifTool/TagNames.pod +61 -13
  31. data/bin/lib/Image/ExifTool/WriteQuickTime.pl +4 -2
  32. data/bin/lib/Image/ExifTool/Writer.pl +166 -134
  33. data/bin/lib/Image/ExifTool/XMP.pm +2 -0
  34. data/bin/lib/Image/ExifTool/XMP2.pl +3 -0
  35. data/bin/lib/Image/ExifTool.pm +59 -27
  36. data/bin/lib/Image/ExifTool.pod +88 -71
  37. data/bin/perl-Image-ExifTool.spec +45 -45
  38. data/lib/exiftool_vendored/version.rb +1 -1
  39. metadata +3 -20
  40. data/bin/lib/Image/ExifTool/GeoLang/cs.pm +0 -978
  41. data/bin/lib/Image/ExifTool/GeoLang/de.pm +0 -1975
  42. data/bin/lib/Image/ExifTool/GeoLang/en_ca.pm +0 -44
  43. data/bin/lib/Image/ExifTool/GeoLang/en_gb.pm +0 -124
  44. data/bin/lib/Image/ExifTool/GeoLang/es.pm +0 -2921
  45. data/bin/lib/Image/ExifTool/GeoLang/fi.pm +0 -1116
  46. data/bin/lib/Image/ExifTool/GeoLang/fr.pm +0 -3171
  47. data/bin/lib/Image/ExifTool/GeoLang/it.pm +0 -2750
  48. data/bin/lib/Image/ExifTool/GeoLang/ja.pm +0 -10256
  49. data/bin/lib/Image/ExifTool/GeoLang/ko.pm +0 -4499
  50. data/bin/lib/Image/ExifTool/GeoLang/nl.pm +0 -1270
  51. data/bin/lib/Image/ExifTool/GeoLang/pl.pm +0 -3019
  52. data/bin/lib/Image/ExifTool/GeoLang/ru.pm +0 -18220
  53. data/bin/lib/Image/ExifTool/GeoLang/sk.pm +0 -441
  54. data/bin/lib/Image/ExifTool/GeoLang/sv.pm +0 -714
  55. data/bin/lib/Image/ExifTool/GeoLang/tr.pm +0 -452
  56. data/bin/lib/Image/ExifTool/GeoLang/zh_cn.pm +0 -2225
  57. data/bin/lib/Image/ExifTool/GeoLang/zh_tw.pm +0 -72
@@ -29,7 +29,6 @@ sub ConvInv($$$$$;$$);
29
29
  sub PushValue($$$;$);
30
30
 
31
31
  my $loadedAllTables; # flag indicating we loaded all tables
32
- my $advFmtSelf; # ExifTool object during evaluation of advanced formatting expr
33
32
 
34
33
  # the following is a road map of where we write each directory
35
34
  # in the different types of files.
@@ -1234,7 +1233,8 @@ WriteAlso:
1234
1233
 
1235
1234
  #------------------------------------------------------------------------------
1236
1235
  # set new values from information in specified file
1237
- # Inputs: 0) ExifTool object reference, 1) source file name or reference, etc
1236
+ # Inputs: 0) ExifTool object reference, 1) source file name or reference, etc,
1237
+ # or ExifTool ref to use already-extracted tags from an ExifTool object,
1238
1238
  # 2-N) List of tags to set (or all if none specified), or reference(s) to
1239
1239
  # hash for options to pass to SetNewValue. The Replace option defaults
1240
1240
  # to 1 for SetNewValuesFromFile -- set this to 0 to allow multiple tags
@@ -1245,11 +1245,12 @@ WriteAlso:
1245
1245
  # be used to represent all tags in a group. An optional destination tag
1246
1246
  # may be specified with '>DSTTAG' ('DSTTAG<TAG' also works, but in this
1247
1247
  # case the source tag may also be an expression involving tag names).
1248
+ # Simple assignments are also allowed: 'DSTTAG[#][+-][^]=[string]'
1248
1249
  sub SetNewValuesFromFile($$;@)
1249
1250
  {
1250
1251
  local $_;
1251
1252
  my ($self, $srcFile, @setTags) = @_;
1252
- my ($key, $tag, @exclude, @reqTags);
1253
+ my ($srcExifTool, $key, $tag, @exclude, @reqTags, $info);
1253
1254
 
1254
1255
  # get initial SetNewValuesFromFile options
1255
1256
  my %opts = ( Replace => 1 ); # replace existing list items by default
@@ -1261,125 +1262,131 @@ sub SetNewValuesFromFile($$;@)
1261
1262
  }
1262
1263
  # expand shortcuts
1263
1264
  @setTags and ExpandShortcuts(\@setTags);
1264
- my $srcExifTool = Image::ExifTool->new;
1265
- # set flag to indicate we are being called from inside SetNewValuesFromFile()
1266
- $$srcExifTool{TAGS_FROM_FILE} = 1;
1267
- # synchronize and increment the file sequence number
1268
- $$srcExifTool{FILE_SEQUENCE} = $$self{FILE_SEQUENCE}++;
1269
1265
  # set options for our extraction tool
1270
1266
  my $options = $$self{OPTIONS};
1271
- # copy both structured and flattened tags by default (but flattened tags are "unsafe")
1272
- my $structOpt = defined $$options{Struct} ? $$options{Struct} : 2;
1273
- # copy structures only if no tags specified (since flattened tags are "unsafe")
1274
- $structOpt = 1 if $structOpt eq '2' and not @setTags;
1275
- # +------------------------------------------+
1276
- # ! DON'T FORGET!! Must consider each new !
1277
- # ! option to decide how it is handled here. !
1278
- # +------------------------------------------+
1279
- $srcExifTool->Options(
1280
- Binary => 1,
1281
- ByteUnit => $$options{ByteUnit},
1282
- Charset => $$options{Charset},
1283
- CharsetEXIF => $$options{CharsetEXIF},
1284
- CharsetFileName => $$options{CharsetFileName},
1285
- CharsetID3 => $$options{CharsetID3},
1286
- CharsetIPTC => $$options{CharsetIPTC},
1287
- CharsetPhotoshop=> $$options{CharsetPhotoshop},
1288
- Composite => $$options{Composite},
1289
- CoordFormat => $$options{CoordFormat} || '%d %d %.8f', # copy coordinates at high resolution unless otherwise specified
1290
- DateFormat => $$options{DateFormat},
1291
- Duplicates => 1,
1292
- Escape => $$options{Escape},
1293
- # Exclude (set below)
1294
- ExtendedXMP => $$options{ExtendedXMP},
1295
- ExtractEmbedded => $$options{ExtractEmbedded},
1296
- FastScan => $$options{FastScan},
1297
- Filter => $$options{Filter},
1298
- FixBase => $$options{FixBase},
1299
- Geolocation => $$options{Geolocation},
1300
- GeolocAltNames => $$options{GeolocAltNames},
1301
- GeolocFeature => $$options{GeolocFeature},
1302
- GeolocMinPop => $$options{GeolocMinPop},
1303
- GeolocMaxDist => $$options{GeolocMaxDist},
1304
- GlobalTimeShift => $$options{GlobalTimeShift},
1305
- HexTagIDs => $$options{HexTagIDs},
1306
- IgnoreMinorErrors=>$$options{IgnoreMinorErrors},
1307
- IgnoreTags => $$options{IgnoreTags},
1308
- ImageHashType => $$options{ImageHashType},
1309
- Lang => $$options{Lang},
1310
- LargeFileSupport=> $$options{LargeFileSupport},
1311
- LimitLongValues => 10000000, # (10 MB)
1312
- List => 1,
1313
- ListItem => $$options{ListItem},
1314
- ListSep => $$options{ListSep},
1315
- MakerNotes => $$options{FastScan} && $$options{FastScan} > 1 ? undef : 1,
1316
- MDItemTags => $$options{MDItemTags},
1317
- MissingTagValue => $$options{MissingTagValue},
1318
- NoPDFList => $$options{NoPDFList},
1319
- NoWarning => $$options{NoWarning},
1320
- Password => $$options{Password},
1321
- PrintConv => $$options{PrintConv},
1322
- QuickTimeUTC => $$options{QuickTimeUTC},
1323
- RequestAll => $$options{RequestAll} || 1, # (is this still necessary now that RequestTags are being set?)
1324
- RequestTags => $$options{RequestTags},
1325
- SaveFormat => $$options{SaveFormat},
1326
- SavePath => $$options{SavePath},
1327
- ScanForXMP => $$options{ScanForXMP},
1328
- StrictDate => defined $$options{StrictDate} ? $$options{StrictDate} : 1,
1329
- Struct => $structOpt,
1330
- StructFormat => $$options{StructFormat},
1331
- SystemTags => $$options{SystemTags},
1332
- TimeZone => $$options{TimeZone},
1333
- Unknown => $$options{Unknown},
1334
- UserParam => $$options{UserParam},
1335
- Validate => $$options{Validate},
1336
- WindowsWideFile => $$options{WindowsWideFile},
1337
- XAttrTags => $$options{XAttrTags},
1338
- XMPAutoConv => $$options{XMPAutoConv},
1339
- );
1340
- # reset Geolocation option if we aren't copying any geolocation tags
1341
- if ($$options{Geolocation} and not grep /\bGeolocation/i, @setTags) {
1342
- $self->VPrint(0, '(resetting unnecessary Geolocation option)');
1343
- $$srcExifTool{OPTIONS}{Geolocation} = undef;
1344
- }
1345
- $$srcExifTool{GLOBAL_TIME_OFFSET} = $$self{GLOBAL_TIME_OFFSET};
1346
- $$srcExifTool{ALT_EXIFTOOL} = $$self{ALT_EXIFTOOL};
1347
- foreach $tag (@setTags) {
1348
- next if ref $tag;
1349
- if ($tag =~ /^-(.*)/) {
1350
- # avoid extracting tags that are excluded
1351
- push @exclude, $1;
1352
- next;
1353
- }
1354
- # add specified tags to list of requested tags
1355
- $_ = $tag;
1356
- if (/(.+?)\s*(>|<)\s*(.+)/) {
1357
- if ($2 eq '>') {
1358
- $_ = $1;
1359
- } else {
1360
- $_ = $3;
1361
- /\$/ and push(@reqTags, /\$\{?(?:[-\w]+:)*([-\w?*]+)/g), next;
1362
- }
1363
- }
1364
- push @reqTags, $2 if /(^|:)([-\w?*]+)#?$/;
1365
- }
1366
- if (@exclude) {
1367
- ExpandShortcuts(\@exclude, 1);
1368
- $srcExifTool->Options(Exclude => \@exclude);
1369
- }
1370
- $srcExifTool->Options(RequestTags => \@reqTags) if @reqTags;
1371
1267
  my $printConv = $$options{PrintConv};
1372
1268
  if ($opts{Type}) {
1373
1269
  # save source type separately because it may be different than dst Type
1374
1270
  $opts{SrcType} = $opts{Type};
1375
1271
  # override PrintConv option with initial Type if given
1376
1272
  $printConv = ($opts{Type} eq 'PrintConv' ? 1 : 0);
1377
- $srcExifTool->Options(PrintConv => $printConv);
1378
1273
  }
1379
1274
  my $srcType = $printConv ? 'PrintConv' : 'ValueConv';
1275
+ my $structOpt = defined $$options{Struct} ? $$options{Struct} : 2;
1380
1276
 
1381
- # get all tags from source file (including MakerNotes block)
1382
- my $info = $srcExifTool->ImageInfo($srcFile);
1277
+ if (ref $srcFile and UNIVERSAL::isa($srcFile,'Image::ExifTool')) {
1278
+ $srcExifTool = $srcFile;
1279
+ $info = $srcExifTool->GetInfo({ PrintConv => $printConv });
1280
+ } else {
1281
+ $srcExifTool = Image::ExifTool->new;
1282
+ $srcExifTool->Options(PrintConv => $printConv);
1283
+ # set flag to indicate we are being called from inside SetNewValuesFromFile()
1284
+ $$srcExifTool{TAGS_FROM_FILE} = 1;
1285
+ # synchronize and increment the file sequence number
1286
+ $$srcExifTool{FILE_SEQUENCE} = $$self{FILE_SEQUENCE}++;
1287
+ # copy both structured and flattened tags by default (but flattened tags are "unsafe")
1288
+ # copy structures only if no tags specified (since flattened tags are "unsafe")
1289
+ $structOpt = 1 if $structOpt eq '2' and not @setTags;
1290
+ # +------------------------------------------+
1291
+ # ! DON'T FORGET!! Must consider each new !
1292
+ # ! option to decide how it is handled here. !
1293
+ # +------------------------------------------+
1294
+ $srcExifTool->Options(
1295
+ Binary => 1,
1296
+ ByteUnit => $$options{ByteUnit},
1297
+ Charset => $$options{Charset},
1298
+ CharsetEXIF => $$options{CharsetEXIF},
1299
+ CharsetFileName => $$options{CharsetFileName},
1300
+ CharsetID3 => $$options{CharsetID3},
1301
+ CharsetIPTC => $$options{CharsetIPTC},
1302
+ CharsetPhotoshop=> $$options{CharsetPhotoshop},
1303
+ Composite => $$options{Composite},
1304
+ CoordFormat => $$options{CoordFormat} || '%d %d %.8f', # copy coordinates at high resolution unless otherwise specified
1305
+ DateFormat => $$options{DateFormat},
1306
+ Duplicates => 1,
1307
+ Escape => $$options{Escape},
1308
+ # Exclude (set below)
1309
+ ExtendedXMP => $$options{ExtendedXMP},
1310
+ ExtractEmbedded => $$options{ExtractEmbedded},
1311
+ FastScan => $$options{FastScan},
1312
+ Filter => $$options{Filter},
1313
+ FixBase => $$options{FixBase},
1314
+ Geolocation => $$options{Geolocation},
1315
+ GeolocAltNames => $$options{GeolocAltNames},
1316
+ GeolocFeature => $$options{GeolocFeature},
1317
+ GeolocMinPop => $$options{GeolocMinPop},
1318
+ GeolocMaxDist => $$options{GeolocMaxDist},
1319
+ GlobalTimeShift => $$options{GlobalTimeShift},
1320
+ HexTagIDs => $$options{HexTagIDs},
1321
+ IgnoreGroups => $$options{IgnoreGroups},
1322
+ IgnoreMinorErrors=>$$options{IgnoreMinorErrors},
1323
+ IgnoreTags => $$options{IgnoreTags},
1324
+ ImageHashType => $$options{ImageHashType},
1325
+ Lang => $$options{Lang},
1326
+ LargeFileSupport=> $$options{LargeFileSupport},
1327
+ LimitLongValues => 10000000, # (10 MB)
1328
+ List => 1,
1329
+ ListItem => $$options{ListItem},
1330
+ ListSep => $$options{ListSep},
1331
+ MakerNotes => $$options{FastScan} && $$options{FastScan} > 1 ? undef : 1,
1332
+ MDItemTags => $$options{MDItemTags},
1333
+ MissingTagValue => $$options{MissingTagValue},
1334
+ NoPDFList => $$options{NoPDFList},
1335
+ NoWarning => $$options{NoWarning},
1336
+ Password => $$options{Password},
1337
+ PrintConv => $$options{PrintConv},
1338
+ QuickTimeUTC => $$options{QuickTimeUTC},
1339
+ RequestAll => $$options{RequestAll} || 1, # (is this still necessary now that RequestTags are being set?)
1340
+ RequestTags => $$options{RequestTags},
1341
+ SaveFormat => $$options{SaveFormat},
1342
+ SavePath => $$options{SavePath},
1343
+ ScanForXMP => $$options{ScanForXMP},
1344
+ StrictDate => defined $$options{StrictDate} ? $$options{StrictDate} : 1,
1345
+ Struct => $structOpt,
1346
+ StructFormat => $$options{StructFormat},
1347
+ SystemTags => $$options{SystemTags},
1348
+ TimeZone => $$options{TimeZone},
1349
+ Unknown => $$options{Unknown},
1350
+ UserParam => $$options{UserParam},
1351
+ Validate => $$options{Validate},
1352
+ WindowsWideFile => $$options{WindowsWideFile},
1353
+ XAttrTags => $$options{XAttrTags},
1354
+ XMPAutoConv => $$options{XMPAutoConv},
1355
+ );
1356
+ # reset Geolocation option if we aren't copying any geolocation tags
1357
+ if ($$options{Geolocation} and not grep /\bGeolocation/i, @setTags) {
1358
+ $self->VPrint(0, '(resetting unnecessary Geolocation option)');
1359
+ $$srcExifTool{OPTIONS}{Geolocation} = undef;
1360
+ }
1361
+ $$srcExifTool{GLOBAL_TIME_OFFSET} = $$self{GLOBAL_TIME_OFFSET};
1362
+ $$srcExifTool{ALT_EXIFTOOL} = $$self{ALT_EXIFTOOL};
1363
+ foreach $tag (@setTags) {
1364
+ next if ref $tag;
1365
+ if ($tag =~ /^-(.*)/) {
1366
+ # avoid extracting tags that are excluded
1367
+ push @exclude, $1;
1368
+ next;
1369
+ }
1370
+ # add specified tags to list of requested tags
1371
+ $_ = $tag;
1372
+ if (/(.+?)\s*(>|<)\s*(.+)/) {
1373
+ if ($2 eq '>') {
1374
+ $_ = $1;
1375
+ } else {
1376
+ $_ = $3;
1377
+ /\$/ and push(@reqTags, /\$\{?(?:[-\w]+:)*([-\w?*]+)/g), next;
1378
+ }
1379
+ }
1380
+ push @reqTags, $2 if /(^|:)([-\w?*]+)#?$/;
1381
+ }
1382
+ if (@exclude) {
1383
+ ExpandShortcuts(\@exclude, 1);
1384
+ $srcExifTool->Options(Exclude => \@exclude);
1385
+ }
1386
+ $srcExifTool->Options(RequestTags => \@reqTags) if @reqTags;
1387
+ # get all tags from source file (including MakerNotes block)
1388
+ $info = $srcExifTool->ImageInfo($srcFile);
1389
+ }
1383
1390
  return $info if $$info{Error} and $$info{Error} eq 'Error opening file';
1384
1391
  delete $$srcExifTool{VALUE}{Error}; # delete so we can check this later
1385
1392
 
@@ -1414,6 +1421,7 @@ sub SetNewValuesFromFile($$;@)
1414
1421
  #
1415
1422
  # 1) loop through input list of tags to set, and build @setList
1416
1423
  my (@setList, $set, %setMatches, $t, %altFiles);
1424
+ my $assign = 0;
1417
1425
  foreach $t (@setTags) {
1418
1426
  if (ref $t eq 'HASH') {
1419
1427
  # update current options
@@ -1428,18 +1436,22 @@ sub SetNewValuesFromFile($$;@)
1428
1436
  $tag = lc $t; # change tag/group names to all lower case
1429
1437
  my (@fg, $grp, $dst, $dstGrp, $dstTag, $isExclude);
1430
1438
  # handle redirection to another tag
1431
- if ($tag =~ /(.+?)\s*(>|<)\s*(.+)/) {
1439
+ if ($tag =~ /(.+?)\s*(>|<|=)(\s*)(.*)/) {
1432
1440
  $dstGrp = '';
1433
- my $opt;
1441
+ my ($opt, $op, $spc);
1434
1442
  if ($2 eq '>') {
1435
- ($tag, $dstTag) = ($1, $3);
1443
+ ($tag, $dstTag) = ($1, $4);
1436
1444
  # flag add and delete (eg. '+<' and '-<') redirections
1437
1445
  $opt = $1 if $tag =~ s/\s*([-+])$// or $dstTag =~ s/^([-+])\s*//;
1438
1446
  } else {
1439
- ($tag, $dstTag) = ($3, $1);
1447
+ ($dstTag, $op, $spc, $tag) = ($1, $2, $3, $4);
1440
1448
  $opt = $1 if $dstTag =~ s/\s*([-+])$//;
1441
- # handle expressions
1442
- if ($tag =~ /\$/) {
1449
+ if ($op eq '=') {
1450
+ # simple assignment ($tag will be the new value)
1451
+ $tag = $spc . $tag;
1452
+ undef $tag unless $dstTag =~ s/\^$// or length $tag;
1453
+ $$opts{ASSIGN} = ++$assign;
1454
+ } elsif ($tag =~ /\$/) { # handle expressions
1443
1455
  $tag = $t; # restore original case
1444
1456
  # recover leading whitespace (except for initial single space)
1445
1457
  $tag =~ s/(.+?)\s*(>|<) ?//;
@@ -1452,7 +1464,7 @@ sub SetNewValuesFromFile($$;@)
1452
1464
  }
1453
1465
  $$opts{Replace} = 0 if $dstTag =~ s/^\+//;
1454
1466
  # validate tag name(s)
1455
- unless ($$opts{EXPR} or ValidTagName($tag)) {
1467
+ unless ($$opts{EXPR} or $$opts{ASSIGN} or ValidTagName($tag)) {
1456
1468
  $self->Warn("Invalid tag name '${tag}'. Use '=' not '<' to assign a tag value");
1457
1469
  next;
1458
1470
  }
@@ -1470,7 +1482,7 @@ sub SetNewValuesFromFile($$;@)
1470
1482
  } else {
1471
1483
  $$opts{Replace} = 0 if $tag =~ s/^\+//;
1472
1484
  }
1473
- unless ($$opts{EXPR}) {
1485
+ unless ($$opts{EXPR} or $$opts{ASSIGN}) {
1474
1486
  $isExclude = ($tag =~ s/^-//);
1475
1487
  if ($tag =~ /(.*):(.+)/) {
1476
1488
  ($grp, $tag) = ($1, $2);
@@ -1540,6 +1552,8 @@ sub SetNewValuesFromFile($$;@)
1540
1552
  foreach $set (@setList) {
1541
1553
  $$set[2] and $setMatches{$set} = [ ];
1542
1554
  }
1555
+ # no need to search source tags if doing only assignments
1556
+ undef @tags if $assign == @setList;
1543
1557
  # 3) loop through all tags in source image and save tags matching each setTag
1544
1558
  my (%rtnInfo, $isAlt);
1545
1559
  foreach $tag (@tags) {
@@ -1592,21 +1606,26 @@ SET: foreach $set (@setList) {
1592
1606
  # get options for SetNewValue
1593
1607
  my $opts = $$set[3];
1594
1608
  # handle expressions
1595
- if ($$opts{EXPR}) {
1596
- my $val = $srcExifTool->InsertTagValues($$set[1], \@tags, 'Error');
1597
- my $err = $$srcExifTool{VALUE}{Error};
1598
- if ($err) {
1599
- # pass on any error as a warning unless it is suppressed
1600
- my $noWarn = $$srcExifTool{OPTIONS}{NoWarning};
1601
- unless ($noWarn and (eval { $err =~ /$noWarn/ } or
1602
- # (also apply expression to warning without "[minor] " prefix)
1603
- ($err =~ s/^\[minor\] //i and eval { $err =~ /$noWarn/ })))
1604
- {
1605
- $tag = NextFreeTagKey(\%rtnInfo, 'Warning');
1606
- $rtnInfo{$tag} = $$srcExifTool{VALUE}{Error};
1609
+ if ($$opts{EXPR} or $$opts{ASSIGN}) {
1610
+ my $val;
1611
+ if ($$opts{EXPR}) {
1612
+ $val = $srcExifTool->InsertTagValues($$set[1], \@tags, 'Error');
1613
+ my $err = $$srcExifTool{VALUE}{Error};
1614
+ if ($err) {
1615
+ # pass on any error as a warning unless it is suppressed
1616
+ my $noWarn = $$srcExifTool{OPTIONS}{NoWarning};
1617
+ unless ($noWarn and (eval { $err =~ /$noWarn/ } or
1618
+ # (also apply expression to warning without "[minor] " prefix)
1619
+ ($err =~ s/^\[minor\] //i and eval { $err =~ /$noWarn/ })))
1620
+ {
1621
+ $tag = NextFreeTagKey(\%rtnInfo, 'Warning');
1622
+ $rtnInfo{$tag} = $$srcExifTool{VALUE}{Error};
1623
+ }
1624
+ delete $$srcExifTool{VALUE}{Error};
1625
+ next unless defined $val;
1607
1626
  }
1608
- delete $$srcExifTool{VALUE}{Error};
1609
- next unless defined $val;
1627
+ } else {
1628
+ $val = $$set[1];
1610
1629
  }
1611
1630
  my ($dstGrp, $dstTag) = @{$$set[2]};
1612
1631
  $$opts{Protected} = 1 unless $dstTag =~ /[?*]/ and $dstTag ne '*';
@@ -3360,7 +3379,7 @@ sub InsertTagValues($$;$$$$)
3360
3379
  if (defined $expr and defined $val) {
3361
3380
  local $SIG{'__WARN__'} = \&SetWarning;
3362
3381
  undef $evalWarning;
3363
- $advFmtSelf = $self;
3382
+ $advFmtSelf = $self; # set variable for access to $self in helper functions
3364
3383
  if ($asList) {
3365
3384
  foreach (@val) {
3366
3385
  #### eval advanced formatting expression ($_, $self, @val, $tag, $advFmtSelf)
@@ -3454,6 +3473,19 @@ sub NoDups
3454
3473
  $_ = ($_[0] and $new eq $_) ? undef : $new;
3455
3474
  }
3456
3475
 
3476
+ #------------------------------------------------------------------------------
3477
+ # Utility routine to set in $_ image from current object
3478
+ # Inputs: 0-N) list of tags to copy
3479
+ # Returns: Return value from WriteInfo
3480
+ # Notes: - for use only in advanced formatting expressions
3481
+ sub SetTags(@)
3482
+ {
3483
+ my $self = $advFmtSelf;
3484
+ my $et = Image::ExifTool->new;
3485
+ $et->SetNewValuesFromFile($self, @_);
3486
+ return $et->WriteInfo(\$_);
3487
+ }
3488
+
3457
3489
  #------------------------------------------------------------------------------
3458
3490
  # Is specified tag writable
3459
3491
  # Inputs: 0) tag name, case insensitive (optional group name currently ignored)
@@ -3794,6 +3794,8 @@ sub ParseXMPElement($$$;$$$$)
3794
3794
  if ($stdNS) {
3795
3795
  $val = $try;
3796
3796
  $et->WarnOnce("Fixed incorrect URI for xmlns:$ns", 1);
3797
+ } elsif ($val =~ m(^http://ns.nikon.com/BASIC_PARAM)) {
3798
+ $et->OverrideFileType('NXD','application/x-nikon-nxd');
3797
3799
  } else {
3798
3800
  # look for same namespace with different version number
3799
3801
  $try = quotemeta $val; # (note: escapes slashes too)
@@ -1941,6 +1941,9 @@ my %sACDSeeRegionStruct = (
1941
1941
  ValueConv => 'Image::ExifTool::XMP::DecodeBase64($val)',
1942
1942
  ValueConvInv => 'Image::ExifTool::XMP::EncodeBase64($val)',
1943
1943
  },
1944
+ MotionPhoto => { Writable => 'integer' },
1945
+ MotionPhotoVersion => { Writable => 'integer' },
1946
+ MotionPhotoPresentationTimestampUs => { Writable => 'integer' },
1944
1947
  );
1945
1948
 
1946
1949
  # Google creations namespace (ref PH)