exiftool_vendored 12.83.0 → 12.86.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bce9ba4475bbab2af98e446daf68e2ebc3e20f5f8babe75cb6c4c30c2d64e249
4
- data.tar.gz: 3f9168ef86dba7aeeaaf05175e9ca061555aef3c265fca25e4716bfb201f37c4
3
+ metadata.gz: 545516d00429f2217884ee7dd4339504e84b836ee2b778fa44707a637bc4184c
4
+ data.tar.gz: a3737fb33959d687603b58ec0062ae907853bbae9bcc856ca10d1ac560368658
5
5
  SHA512:
6
- metadata.gz: 2c1d039efa83cb5365e55ae6b75c55076afaf93ef816798a221918c99ae65279c7cbdf53aaff59e76168c9cb5c859f05317ad1d286087386ebb351bc848b32bb
7
- data.tar.gz: 9481aa26a7f459d1bc5c9c6cb9fd752ecb1d7ba4a9c5fb0e16b4147e819c5e5c6b0d8dc4efe6571a9a0e32abf49b386c3b03d485993be98ec3ec18d03efefc5f
6
+ metadata.gz: a88fe3c5bad722bbc5e7bf0e0bd07edf8f4dc4707ed6af4895db6eaeacb0a28f14bd1ed72ad90dbfe43fb52eb86c9b569ac858ab5491c3910dfbe79d84cff75a
7
+ data.tar.gz: c9fbb0c789ce33da188841f7d0e37de4fcfac563508941fd1ebcaace1d2c6d074c9d8b9bf0e6c5a570aba8601db0b361c6e66b0243923d1fe54ee918509d3cce
data/bin/Changes CHANGED
@@ -7,6 +7,56 @@ RSS feed: https://exiftool.org/rss.xml
7
7
  Note: The most recent production release is Version 12.76. (Other versions are
8
8
  considered development releases, and are not uploaded to MetaCPAN.)
9
9
 
10
+ June 7, 2024 - Version 12.86
11
+
12
+ - Added a new value for a couple of Olympus tags (thanks Herb)
13
+ - Improved handling of ID3 user-defined tags
14
+ - Decode all JPEG segments from RICO box in Ricoh MOV videos
15
+ - Decode a few new values for some tags written by Canon EOS R cameras
16
+ - Patched some Olympus WB_RBLevels tags to allow 4 values to be written as per
17
+ some newer models
18
+ - Fixed issue when writing IPTC date tags with a date/time value containing
19
+ subseconds with 4 or more digits
20
+
21
+ May 21, 2024 - Version 12.85
22
+
23
+ - Added GeolocationFeatureType tag
24
+ - Added read support for Nikon NKA and NXD adjustment files
25
+ - Added a new Apple:ImageCaptureType value, and changed another one
26
+ - Decode a few new Pentax tags
27
+ - Decode a few new Canon tags
28
+ - Decode some Ricoh Exif metadata from MOV videos
29
+ - Extract ID3 UserDefinedText and UserDefinedURL tags by name
30
+ - Make $advFmtSelf available for user-defined helper functions
31
+ - Documented API GeoDir pseudo option feature
32
+ - Tolerate pad byte at end of HIF file when writing
33
+ - Raised priority of FileName, BaseName, Directory and FileType tags so they
34
+ don't get hidden by other tags in the file which may have these names
35
+ - Changed decoding of QuickTime Rotation (irot) to correspond with
36
+ EXIF:Orientation (previously this was oddly reported as degrees of
37
+ counterclockwise rotation)
38
+ - Fixed a typo in the print conversion value for a couple of DPX tags
39
+ - Fixed problem writing some QuickTime tags with very large (> 16 MB) values
40
+ - Fixed bug in build_geolocation utility that resulted in incorrect population
41
+ numbers when run under ActivePerl
42
+
43
+ Apr. 23, 2024 - Version 12.84
44
+
45
+ - Added ability to read speed and accuracy_horizontal when geotagging from
46
+ OpenTracks GPX files
47
+ - Decode a few more Apple tags and a new CanonVRD tag
48
+ - Enhanced Geolocation feature with the ability to return any number of nearby
49
+ cities
50
+ - Fixed long-standing bug in Windows version that didn't properly handle dates
51
+ older than 50 years when writing FileModifyDate or FileCreateDate
52
+ - Fixed API TimeZone option to work in Windows
53
+ - Fixed problem where the SetTags helper function didn't properly copy tags
54
+ which have print conversions
55
+ - Fixed problem where a new subregion couldn't be added through a user-defined
56
+ Geolocation database entry
57
+ - Fixed problem where the API GeolocFeature option didn't work for some
58
+ features if a user-generated custom database was used
59
+
10
60
  Apr. 18, 2024 - Version 12.83
11
61
 
12
62
  - Added SetTags helper function for use in advanced formatting expressions
@@ -14,7 +64,7 @@ Apr. 18, 2024 - Version 12.83
14
64
  - Added a new Nikon Z lens
15
65
  - Added a couple of new QuickTime tags
16
66
  - Added a few more XMP-GCamera tags
17
- - Added build_geolocation to the full distribution
67
+ - Added build_geolocation utility to the full distribution
18
68
  - Decode a new CanonVRD tag and rename another one
19
69
  - Updates to Sony maker note decoding for newer models (thanks Jos Roost)
20
70
  - Minor change in -p option to avoid adding the trailing newline if the -b
data/bin/META.json CHANGED
@@ -50,5 +50,5 @@
50
50
  }
51
51
  },
52
52
  "release_status" : "stable",
53
- "version" : "12.83"
53
+ "version" : "12.86"
54
54
  }
data/bin/META.yml CHANGED
@@ -31,4 +31,4 @@ recommends:
31
31
  Time::HiRes: 0
32
32
  requires:
33
33
  perl: 5.004
34
- version: 12.83
34
+ version: 12.86
data/bin/README CHANGED
@@ -14,50 +14,50 @@ supported by ExifTool (r = read, w = write, c = create):
14
14
 
15
15
  File Types
16
16
  ------------+-------------+-------------+-------------+------------
17
- 360 r/w | DOCX r | ITC r | O r | RSRC r
18
- 3FR r | DPX r | J2C r | ODP r | RTF r
19
- 3G2 r/w | DR4 r/w/c | JNG r/w | ODS r | RW2 r/w
20
- 3GP r/w | DSS r | JP2 r/w | ODT r | RWL r/w
21
- 7Z r | DV r | JPEG r/w | OFR r | RWZ r
22
- A r | DVB r/w | JSON r | OGG r | RM r
23
- AA r | DVR-MS r | JXL r/w | OGV r | SEQ r
24
- AAC r | DYLIB r | K25 r | ONP r | SKETCH r
25
- AAE r | EIP r | KDC r | OPUS r | SO r
26
- AAX r/w | EPS r/w | KEY r | ORF r/w | SR2 r/w
27
- ACR r | EPUB r | LA r | ORI r/w | SRF r
28
- AFM r | ERF r/w | LFP r | OTF r | SRW r/w
29
- AI r/w | EXE r | LIF r | PAC r | SVG r
30
- AIFF r | EXIF r/w/c | LNK r | PAGES r | SWF r
31
- APE r | EXR r | LRV r/w | PBM r/w | THM r/w
32
- ARQ r/w | EXV r/w/c | M2TS r | PCD r | TIFF r/w
33
- ARW r/w | F4A/V r/w | M4A/V r/w | PCX r | TORRENT r
34
- ASF r | FFF r/w | MACOS r | PDB r | TTC r
35
- AVI r | FITS r | MAX r | PDF r/w | TTF r
36
- AVIF r/w | FLA r | MEF r/w | PEF r/w | TXT r
37
- AZW r | FLAC r | MIE r/w/c | PFA r | VCF r
38
- BMP r | FLIF r/w | MIFF r | PFB r | VNT r
39
- BPG r | FLV r | MKA r | PFM r | VRD r/w/c
40
- BTF r | FPF r | MKS r | PGF r | VSD r
41
- C2PA r | FPX r | MKV r | PGM r/w | WAV r
42
- CHM r | GIF r/w | MNG r/w | PLIST r | WDP r/w
43
- COS r | GLV r/w | MOBI r | PICT r | WEBP r/w
44
- CR2 r/w | GPR r/w | MODD r | PMP r | WEBM r
45
- CR3 r/w | GZ r | MOI r | PNG r/w | WMA r
46
- CRM r/w | HDP r/w | MOS r/w | PPM r/w | WMV r
47
- CRW r/w | HDR r | MOV r/w | PPT r | WPG r
48
- CS1 r/w | HEIC r/w | MP3 r | PPTX r | WTV r
49
- CSV r | HEIF r/w | MP4 r/w | PS r/w | WV r
50
- CUR r | HTML r | MPC r | PSB r/w | X3F r/w
51
- CZI r | ICC r/w/c | MPG r | PSD r/w | XCF r
52
- DCM r | ICO r | MPO r/w | PSP r | XISF r
53
- DCP r/w | ICS r | MQV r/w | QTIF r/w | XLS r
54
- DCR r | IDML r | MRC r | R3D r | XLSX r
55
- DFONT r | IIQ r/w | MRW r/w | RA r | XMP r/w/c
56
- DIVX r | IND r/w | MXF r | RAF r/w | ZIP r
57
- DJVU r | INSP r/w | NEF r/w | RAM r |
58
- DLL r | INSV r | NKSC r/w | RAR r |
59
- DNG r/w | INX r | NRW r/w | RAW r/w |
60
- DOC r | ISO r | NUMBERS r | RIFF r |
17
+ 360 r/w | DOCX r | ITC r | NUMBERS r | RAW r/w
18
+ 3FR r | DPX r | J2C r | NXD r | RIFF r
19
+ 3G2 r/w | DR4 r/w/c | JNG r/w | O r | RSRC r
20
+ 3GP r/w | DSS r | JP2 r/w | ODP r | RTF r
21
+ 7Z r | DV r | JPEG r/w | ODS r | RW2 r/w
22
+ A r | DVB r/w | JSON r | ODT r | RWL r/w
23
+ AA r | DVR-MS r | JXL r/w | OFR r | RWZ r
24
+ AAC r | DYLIB r | K25 r | OGG r | RM r
25
+ AAE r | EIP r | KDC r | OGV r | SEQ r
26
+ AAX r/w | EPS r/w | KEY r | ONP r | SKETCH r
27
+ ACR r | EPUB r | LA r | OPUS r | SO r
28
+ AFM r | ERF r/w | LFP r | ORF r/w | SR2 r/w
29
+ AI r/w | EXE r | LIF r | ORI r/w | SRF r
30
+ AIFF r | EXIF r/w/c | LNK r | OTF r | SRW r/w
31
+ APE r | EXR r | LRV r/w | PAC r | SVG r
32
+ ARQ r/w | EXV r/w/c | M2TS r | PAGES r | SWF r
33
+ ARW r/w | F4A/V r/w | M4A/V r/w | PBM r/w | THM r/w
34
+ ASF r | FFF r/w | MACOS r | PCD r | TIFF r/w
35
+ AVI r | FITS r | MAX r | PCX r | TORRENT r
36
+ AVIF r/w | FLA r | MEF r/w | PDB r | TTC r
37
+ AZW r | FLAC r | MIE r/w/c | PDF r/w | TTF r
38
+ BMP r | FLIF r/w | MIFF r | PEF r/w | TXT r
39
+ BPG r | FLV r | MKA r | PFA r | VCF r
40
+ BTF r | FPF r | MKS r | PFB r | VNT r
41
+ C2PA r | FPX r | MKV r | PFM r | VRD r/w/c
42
+ CHM r | GIF r/w | MNG r/w | PGF r | VSD r
43
+ COS r | GLV r/w | MOBI r | PGM r/w | WAV r
44
+ CR2 r/w | GPR r/w | MODD r | PLIST r | WDP r/w
45
+ CR3 r/w | GZ r | MOI r | PICT r | WEBP r/w
46
+ CRM r/w | HDP r/w | MOS r/w | PMP r | WEBM r
47
+ CRW r/w | HDR r | MOV r/w | PNG r/w | WMA r
48
+ CS1 r/w | HEIC r/w | MP3 r | PPM r/w | WMV r
49
+ CSV r | HEIF r/w | MP4 r/w | PPT r | WPG r
50
+ CUR r | HTML r | MPC r | PPTX r | WTV r
51
+ CZI r | ICC r/w/c | MPG r | PS r/w | WV r
52
+ DCM r | ICO r | MPO r/w | PSB r/w | X3F r/w
53
+ DCP r/w | ICS r | MQV r/w | PSD r/w | XCF r
54
+ DCR r | IDML r | MRC r | PSP r | XISF r
55
+ DFONT r | IIQ r/w | MRW r/w | QTIF r/w | XLS r
56
+ DIVX r | IND r/w | MXF r | R3D r | XLSX r
57
+ DJVU r | INSP r/w | NEF r/w | RA r | XMP r/w/c
58
+ DLL r | INSV r | NKA r | RAF r/w | ZIP r
59
+ DNG r/w | INX r | NKSC r/w | RAM r |
60
+ DOC r | ISO r | NRW r/w | RAR r |
61
61
 
62
62
  Meta Information
63
63
  ----------------------+----------------------+---------------------
@@ -109,8 +109,8 @@ your home directory, then you would type the following commands in a
109
109
  terminal window to extract and run ExifTool:
110
110
 
111
111
  cd ~/Desktop
112
- gzip -dc Image-ExifTool-12.83.tar.gz | tar -xf -
113
- cd Image-ExifTool-12.83
112
+ gzip -dc Image-ExifTool-12.86.tar.gz | tar -xf -
113
+ cd Image-ExifTool-12.86
114
114
  ./exiftool t/images/ExifTool.jpg
115
115
 
116
116
  Note: These commands extract meta information from one of the test images.
@@ -10,6 +10,11 @@
10
10
  #
11
11
  # Created: 2024-03-03 - P. Harvey
12
12
  # 2024-04-15 - PH Clean up and add options for public release
13
+ # 2024-04-22 - PH Increased number of possible feature codes from
14
+ # 32 to 64. Convert backslashes in directory names
15
+ # 2024-04-24 - PH Fixed problem with population exponent when run
16
+ # under ActivePerl
17
+ # 2024-04-29 - PH Added feature types and default to db v1.03
13
18
  #
14
19
  # Notes: Requires these files from https://download.geonames.org/export/
15
20
  #
@@ -17,6 +22,7 @@
17
22
  # countryInfo.txt
18
23
  # admin1CodesASCII.txt
19
24
  # admin2Codes.txt
25
+ # featureCodes_XX.txt (optional)
20
26
  # alternateNamesV2.txt (optional)
21
27
  #
22
28
  # Output datbase format (Geolocation.dat):
@@ -35,7 +41,7 @@
35
41
  # 9 int16u - v1.02: 0x7fff = index in subregion (admin2), 0x8000 = high bit of time zone
36
42
  # 9 int16u - v1.03: index in subregion (admin2)
37
43
  # 11 int8u - low byte of time zone index
38
- # 12 int8u - 0x1f = feature code index (see below), v1.03: 0x80 = high bit of time zone
44
+ # 12 int8u - 0x3f = feature code index (see below), v1.03: 0x80 = high bit of time zone
39
45
  # 13 string - UTF8 City name, terminated by newline
40
46
  # "\0\0\0\0\x01"
41
47
  # Country entries:
@@ -52,7 +58,7 @@
52
58
  # 1. Time zone name, terminated by newline
53
59
  # "\0\0\0\0\x05" (feature codes added in v1.03)
54
60
  # Feature codes:
55
- # 1. Feature code, terminated by newline
61
+ # 1. Feature code, optional space-followed-by-feature-name, then newline
56
62
  # "\0\0\0\0\0"
57
63
  #
58
64
  # Feature Codes v1.02: (see http://www.geonames.org/export/codes.html#P for descriptions)
@@ -66,12 +72,12 @@
66
72
 
67
73
  use strict;
68
74
 
69
- my $dbVer = '1.02'; # database version
70
-
75
+ my $dbVer = '1.03'; # default output database version
71
76
  my $dbFile = 'allCountries.txt'; # default database file
72
77
  my $countryFile = 'countryInfo.txt'; # mandatory country names file
73
78
  my $regionFile = 'admin1CodesASCII.txt'; # mandatory region names file
74
79
  my $admin2File = 'admin2Codes.txt'; # mandatory subregion names file
80
+ my $featureFile = 'featureCodes_en.txt'; # optional feature names file
75
81
  my $altNamesFile = 'alternateNamesV2.txt'; # optional alternate names file
76
82
  my $outFile = 'Geolocation.dat'; # output ExifTool database file
77
83
  my $outAltNames = 'AltNames.dat'; # output alternate names file
@@ -101,6 +107,7 @@ my @fc103 = qw(
101
107
  my $i = 0;
102
108
  my @featureCodes = $dbVer eq '1.02' ? @fc102 : @fc103;
103
109
  my %featureCodes = map { $_ => $i++ } @featureCodes;
110
+ my %featureNames;
104
111
 
105
112
  my ($dbfile, @dbfiles, $outDir, $verbose, $noLang, %needRgn);
106
113
  my %optArgs = ( p => 1, c => 1, cp => 1, l => 1, o => 1, ver => 1 );
@@ -110,6 +117,9 @@ my $opts = { };
110
117
  while (@ARGV) {
111
118
  my $opt = shift;
112
119
  if (not $opt =~ s/^-//) {
120
+ $opt = '.' unless length $opt;
121
+ $opt =~ tr(\\)(/); # use forward slashes
122
+ $opt =~ s(/$)(); # remove trailing slash
113
123
  $opt = "$opt/$defaults{file}" if -d $opt;
114
124
  -e $opt or die "Error opening database $opt\n";
115
125
  push @dbfiles, { %defaults, %$opts, file => $opt };
@@ -235,12 +245,13 @@ Options:
235
245
  -h - Show this help.
236
246
 
237
247
  Input files (download from https://download.geonames.org/export/dump/):
238
- allCountries.txt - default database file (smaller files with names
248
+ $dbFile - default database file (smaller files with names
239
249
  like "cities###.txt" may be specified instead)
240
- countryInfo.txt - mandatory country names file
241
- admin1CodesASCII.txt - mandatory region names file
242
- admin2Codes.txt - mandatory subregion names file
243
- alternateNamesV2.txt - optional alternate names file (must exist to
250
+ $countryFile - mandatory country names file
251
+ $regionFile - mandatory region names file
252
+ $admin2File - mandatory subregion names file
253
+ $featureFile - optional feature codes file
254
+ $altNamesFile - optional alternate names file (must exist to
244
255
  to generate $outAltNames and $geoLang files)
245
256
 
246
257
  Output files:
@@ -369,7 +380,7 @@ my @supportedLangs = qw(cs de en-ca en-gb es fi fr it ja ko nl pl ru sk sv tr zh
369
380
 
370
381
  # supported country-specific languages
371
382
  my %ccLang = ( TW => 'zh', CN => 'zh', CA => 'en', GB => 'en' );
372
- my (%lang, %haveCountry, %cityFlags, %rgnFlags, %subFlags, %ccFlags, %flags);
383
+ my (%lang, %featureLang, %haveCountry, %cityFlags, %rgnFlags, %subFlags, %ccFlags, %flags);
373
384
  my (%haveRegion, %haveSubRgn, $filesize, $percent);
374
385
 
375
386
  sub GetFileSize($)
@@ -381,7 +392,8 @@ sub GetFileSize($)
381
392
  return $size;
382
393
  }
383
394
 
384
- # pre-scan database to determine which countries, regions and subregions we will be using
395
+ # pre-scan database to determine which countries, regions subregions and
396
+ # feature codes we will be using
385
397
  foreach $dbfile (@dbfiles) {
386
398
  my $database = $$dbfile{file};
387
399
  my $upgraded;
@@ -417,7 +429,7 @@ foreach $dbfile (@dbfiles) {
417
429
  }
418
430
  # keep regardless of population
419
431
  if ($needRgn{$cc} and $$dbfile{keep}{"$cc$rgn"}) {
420
- $keep = $$dbfile{keep}{"$cc$rgn"}{$code};#TEST
432
+ $keep = $$dbfile{keep}{"$cc$rgn"}{$code};
421
433
  } elsif ($$dbfile{keep}{$cc}) {
422
434
  $keep = $$dbfile{keep}{$cc}{$code};
423
435
  } else {
@@ -437,8 +449,8 @@ foreach $dbfile (@dbfiles) {
437
449
  $haveCountry{$cc} = 1;
438
450
  $haveRegion{"$cc$rgn"} = 1;
439
451
  $haveSubRgn{"$cc$rgn.$sub"} = 1;
440
- # add new feature codes (up to maximum index of 0x1f)
441
- unless ($featureCodes{$code} or @featureCodes > 0x1f) {
452
+ # add new feature codes (up to maximum index of 0x3f)
453
+ unless ($featureCodes{$code} or @featureCodes > 0x3f) {
442
454
  if ($dbVer eq '1.02') {
443
455
  next if $code =~ /^(PPLH|PPLQ|PPLW)$/; # (stored as "Other" in v1.02)
444
456
  $dbVer = '1.03';
@@ -457,9 +469,27 @@ foreach $dbfile (@dbfiles) {
457
469
  warn "Some feature codes not supported by version 1.02, writing as 1.03 instead.\n" if $upgraded;
458
470
  }
459
471
 
472
+ # read feature names
473
+ if (open INFILE, '<', "$dbdir/$featureFile") {
474
+ print "Reading $dbdir/$featureFile\n";
475
+ while (<INFILE>) {
476
+ my @items = split /\t/;
477
+ $items[0] =~ s/^.\.//; # remove feature group and "." separator
478
+ next unless $featureCodes{$items[0]};
479
+ my $name = ucfirst $items[1];
480
+ $name =~ s/ ([a-z])/ \U$1/g;
481
+ $featureNames{$items[0]} = $name;
482
+ }
483
+ close INFILE;
484
+ } else {
485
+ print "Not found: $dbdir/$featureFile\n";
486
+ print "--> Not storing feature type names\n";
487
+ }
488
+
460
489
  # read country names
461
490
  $i = 0;
462
491
  open INFILE, '<', "$dbdir/$countryFile" or die "Error opening $dbdir/$countryFile\n";
492
+ print "Reading $dbdir/$countryFile\n";
463
493
  while (<INFILE>) {
464
494
  next if /^#/;
465
495
  my @items = split /\t/;
@@ -474,6 +504,7 @@ die "Too many countries!\n" if $i > 0x100; # (no default 0 entry)
474
504
  # read region (admin1) names
475
505
  $i = 0;
476
506
  open REGION, '<', "$dbdir/$regionFile" or die "Error opening $dbdir/$regionFile\n";
507
+ print "Reading $dbdir/$regionFile\n";
477
508
  while (<REGION>) {
478
509
  chomp;
479
510
  my @items = split /\t/;
@@ -489,6 +520,7 @@ die "Too many regions!\n" if $i > 0x0fff; # (account for default 0 entry)
489
520
  # read subregion (admin2) names
490
521
  $i = 0;
491
522
  open ADMIN2, '<', "$dbdir/$admin2File" or die "Error opening $dbdir/$admin2File\n";
523
+ print "Reading $dbdir/$admin2File\n";
492
524
  while (<ADMIN2>) {
493
525
  chomp;
494
526
  my @items = split /\t/;
@@ -539,8 +571,35 @@ if (not $noLang and open INFILE, '<', "$dbdir/$altNamesFile") {
539
571
  }
540
572
  print "\b\b\b\bDone.\n";
541
573
  close INFILE;
574
+ # read alternate feature names
575
+ if (%featureNames) {
576
+ my $lng;
577
+ foreach $lng (@languages) {
578
+ next if $lng eq 'en' or not $languages{$lng};
579
+ my $file = "$dbdir/$featureFile";
580
+ $file =~ s/_en\./_$lng./ or next;
581
+ next unless open INFILE, '<', $file;
582
+ print "Reading $file\n";
583
+ while (<INFILE>) {
584
+ my @items = split /\t/;
585
+ $items[0] =~ s/^.\.//; # remove feature group and "." separator
586
+ next unless $featureNames{$items[0]};
587
+ utf8::decode($items[1]);
588
+ my $name = ucfirst $items[1];
589
+ $name =~ s/ (.)/ \U$1/g;
590
+ # change $name back to byte string
591
+ if ($] >= 5.006 and (eval { require Encode; Encode::is_utf8($name) } or $@)) {
592
+ $name = $@ ? pack('C*',unpack($] < 5.010000 ? 'U0C*' : 'C0C*',$name)) : Encode::encode('utf8',$name);
593
+ }
594
+ next if $name eq $featureNames{$items[0]};
595
+ $featureLang{$lng}{$items[0]} = $name;
596
+ }
597
+ close INFILE;
598
+ }
599
+ }
542
600
  } else {
543
- print "Not writing alternate languages ($dbdir/$altNamesFile not found)\n";
601
+ print "Not found: $dbdir/$altNamesFile\n--> " unless $noLang;
602
+ print "Not writing alternate languages\n";
544
603
  $noLang = 1;
545
604
  }
546
605
 
@@ -549,7 +608,7 @@ my (%coords, %langLookups);
549
608
  foreach $dbfile (@dbfiles) {
550
609
  my $database = $$dbfile{file};
551
610
 
552
- print "Processing $database... 0%";
611
+ print "Processing database entries... 0%";
553
612
  my $i = 0;
554
613
  my $num = scalar @{$$dbfile{kept}};
555
614
 
@@ -618,6 +677,7 @@ foreach (sort { $a cmp $b } keys %coords) {
618
677
  my $items = $coords{$_};
619
678
  # @$items=(0.lat,1.lon,2.city,3.cc,4.rgn,5.admin2,6.population,7.timezone,8.feature code,9.alt names)
620
679
  my $iCC = $orderCC{$$items[3]};
680
+ defined $iCC or warn("Unknown country code $$items[3]\n"), next;
621
681
  my $iRgn = $orderRgn{"$$items[3]$$items[4]"} || 0;
622
682
  my $iSub = $orderSub{"$$items[3]$$items[4].$$items[5]"} || 0;
623
683
  my $tn = $tz{$$items[7]};
@@ -626,9 +686,12 @@ foreach (sort { $a cmp $b } keys %coords) {
626
686
  $tn = $tz{$$items[7]} = $tzNum++;
627
687
  }
628
688
  # convert population to our binary format
629
- my $pop = sprintf('%.1e',$$items[6]); # format: "3.1e+04"
689
+ # Note: format in ActivePerl is "3.1e+004", but "3.1+04" in other Perls,
690
+ # but other Perls will round 34500 to "3.4e+04", so add 1 to get "3.5e+04"
691
+ $$items[6] += 1 if $$items[6] > 100 and not $$items[6] % 10;
692
+ my $pop = sprintf('%.1e',$$items[6]);
630
693
  # pack CC, population and region index into a 32-bit integer
631
- my $code = ($iCC << 24) | (substr($pop,6,1)<<20) | (substr($pop,0,1)<<16) | (substr($pop,2,1)<<12) | $iRgn;
694
+ my $code = ($iCC << 24) | (substr($pop,-1,1)<<20) | (substr($pop,0,1)<<16) | (substr($pop,2,1)<<12) | $iRgn;
632
695
  $fcodes{$$items[8]} = ($fcodes{$$items[8]} || 0) + 1;
633
696
  my $fc = $featureCodes{$$items[8]} || 0;
634
697
  # store high bit of timezone index
@@ -756,8 +819,12 @@ print OUTFILE $_,"\n" foreach @tz;
756
819
 
757
820
  print OUTFILE "\0\0\0\0\x05\n"; # section terminator
758
821
 
759
- # write feature codes
760
- print OUTFILE $_,"\n" foreach @featureCodes;
822
+ # write feature codes and optional names
823
+ foreach (@featureCodes) {
824
+ print OUTFILE $_;
825
+ print OUTFILE ' ', $featureNames{$_} if $featureNames{$_};
826
+ print OUTFILE "\n";
827
+ }
761
828
 
762
829
  # write terminator and close Geolocation.dat
763
830
  print OUTFILE "\0\0\0\0\0\n"; # file terminator
@@ -769,7 +836,9 @@ my $langSize = 0;
769
836
  my $langDir = "$outDir/$geoLang";
770
837
  # delete existing languages
771
838
  unlink <"$langDir/*.pm">;
772
- unless ($noLang) {
839
+ if ($noLang) {
840
+ rmdir $langDir;
841
+ } else {
773
842
  my $n = scalar(keys %langLookups);
774
843
  print "Writing $n language files to $outDir/$geoLang...\n";
775
844
  mkdir $langDir, 0777;
@@ -780,6 +849,7 @@ unless ($noLang) {
780
849
  my $lkup = $langLookups{$lng};
781
850
  my $file = "$myLng.pm";
782
851
  open OUT, ">$langDir/$file" or die "Error creating $file\n";
852
+ binmode OUT;
783
853
  print OUT "# Geolocation language translations for $myLng\n";
784
854
  print OUT "#\n# Based on Creative Commons database from geonames.org\n\n";
785
855
  print OUT "%Image::ExifTool::GeoLang::${myLng}::Translate = (\n";
@@ -837,6 +907,14 @@ unless ($noLang) {
837
907
  }
838
908
  }
839
909
  }
910
+ if ($featureLang{$lng}) {
911
+ print OUT "\n\t# feature types\n";
912
+ foreach (sort keys %{$featureLang{$lng}}) {
913
+ my $ftype = $featureLang{$lng}{$_};
914
+ $ftype =~ s/'/\\'/g;
915
+ print OUT "\t$_ => '$ftype',\n"
916
+ }
917
+ }
840
918
  print OUT ");\n\n1; #end\n";
841
919
  $langSize += tell OUT;
842
920
  close OUT;
@@ -293,6 +293,11 @@
293
293
  NewXMPxxxStructX => { Name => 'SomeOtherName', Flat => 1 },
294
294
  );
295
295
 
296
+ # the namespace may be registered so ExifTool generates the expected family 1
297
+ # group names when reading if the UserDefined namespace uses a different prefix
298
+ require Image::ExifTool::XMP;
299
+ Image::ExifTool::XMP::RegisterNamespace(\%Image::ExifTool::UserDefined::xxx);
300
+
296
301
  # Adding a new MIE group requires a few extra definitions
297
302
  use Image::ExifTool::MIE;
298
303
  %Image::ExifTool::UserDefined::MIETest = (
@@ -364,8 +369,8 @@ $Image::ExifTool::QuickTime::Keys{PREFERRED} = 3;
364
369
 
365
370
  # Add user-defined cities to the Geolocation lookup
366
371
  @Image::ExifTool::UserDefined::Geolocation = (
367
- # (city,region,country code,country,timezone,population,lat,lon)
368
- ['Sinemorets','Burgas','BG','Bulgaria','Europe/Sofia',400,42.06115,27.97833],
372
+ # (city,region,subregion,country_code,country,timezone,feature_code,population,lat,lon)
373
+ ['Sinemorets','burgas','Obshtina Tsarevo','BG','','Europe/Sofia','PPL',400,42.06115,27.97833],
369
374
  );
370
375
 
371
376
  #------------------------------------------------------------------------------