exiftool-vendored.pl 12.84.0 → 12.89.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/bin/Changes +94 -3
  2. package/bin/MANIFEST +1 -0
  3. package/bin/META.json +1 -1
  4. package/bin/META.yml +16 -16
  5. package/bin/README +47 -46
  6. package/bin/build_geolocation +96 -20
  7. package/bin/config_files/example.config +5 -0
  8. package/bin/config_files/onone.config +28 -0
  9. package/bin/exiftool +67 -57
  10. package/bin/lib/Image/ExifTool/AIFF.pm +8 -4
  11. package/bin/lib/Image/ExifTool/ASF.pm +4 -1
  12. package/bin/lib/Image/ExifTool/Apple.pm +2 -1
  13. package/bin/lib/Image/ExifTool/BuildTagLookup.pm +14 -8
  14. package/bin/lib/Image/ExifTool/Canon.pm +100 -7
  15. package/bin/lib/Image/ExifTool/CanonRaw.pm +1 -1
  16. package/bin/lib/Image/ExifTool/CanonVRD.pm +5 -2
  17. package/bin/lib/Image/ExifTool/DPX.pm +3 -3
  18. package/bin/lib/Image/ExifTool/FujiFilm.pm +46 -4
  19. package/bin/lib/Image/ExifTool/Geolocation.dat +0 -0
  20. package/bin/lib/Image/ExifTool/Geolocation.pm +18 -8
  21. package/bin/lib/Image/ExifTool/ID3.pm +36 -8
  22. package/bin/lib/Image/ExifTool/InDesign.pm +8 -4
  23. package/bin/lib/Image/ExifTool/Jpeg2000.pm +0 -1
  24. package/bin/lib/Image/ExifTool/Lang/de.pm +2 -2
  25. package/bin/lib/Image/ExifTool/Matroska.pm +66 -10
  26. package/bin/lib/Image/ExifTool/MinoltaRaw.pm +2 -2
  27. package/bin/lib/Image/ExifTool/Nikon.pm +21 -2
  28. package/bin/lib/Image/ExifTool/Olympus.pm +27 -17
  29. package/bin/lib/Image/ExifTool/Panasonic.pm +1 -0
  30. package/bin/lib/Image/ExifTool/PanasonicRaw.pm +1 -0
  31. package/bin/lib/Image/ExifTool/Pentax.pm +139 -22
  32. package/bin/lib/Image/ExifTool/QuickTime.pm +70 -16
  33. package/bin/lib/Image/ExifTool/QuickTimeStream.pl +24 -2
  34. package/bin/lib/Image/ExifTool/RIFF.pm +20 -10
  35. package/bin/lib/Image/ExifTool/Samsung.pm +29 -1
  36. package/bin/lib/Image/ExifTool/Sony.pm +21 -11
  37. package/bin/lib/Image/ExifTool/TagLookup.pm +6806 -6782
  38. package/bin/lib/Image/ExifTool/TagNames.pod +124 -34
  39. package/bin/lib/Image/ExifTool/WriteIPTC.pl +1 -1
  40. package/bin/lib/Image/ExifTool/WriteQuickTime.pl +86 -16
  41. package/bin/lib/Image/ExifTool/Writer.pl +8 -6
  42. package/bin/lib/Image/ExifTool/XMP.pm +10 -8
  43. package/bin/lib/Image/ExifTool/XMP2.pl +51 -30
  44. package/bin/lib/Image/ExifTool/ZIP.pm +8 -4
  45. package/bin/lib/Image/ExifTool.pm +78 -45
  46. package/bin/lib/Image/ExifTool.pod +66 -50
  47. package/bin/perl-Image-ExifTool.spec +45 -45
  48. package/bin/pp_build_exe.args +4 -4
  49. package/package.json +3 -3
package/bin/Changes CHANGED
@@ -7,13 +7,104 @@ 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
+ July 12, 2024 - Version 12.89
11
+
12
+ - Added new Sony lenses and updated decoding of some tags (thanks Jos Roost)
13
+ - Minor change to description of NKA files
14
+ - Fixed Archive::Zip problem in Windows executable version
15
+
16
+ July 11, 2024 - Version 12.88 - "New Windows/MacOS packages"
17
+
18
+ -
19
+
20
+ NOTE: The install procedure for the Windows executable has changed!
21
+ - Windows EXE version now uses Oliver Betz's bundle with Strawberry Perl and
22
+ comes in 32- and 64-bit versions
23
+ - MacOS distribution now uses a flattened package
24
+ - Added ability to read/write deflate-compressed XMP in HEIC files
25
+ - Added a new Canon LensType (thanks Norbert Wasser)
26
+ - Added a new XMP-GCamera tag (thanks Herb)
27
+ - Added a new Nikon LensID
28
+ - Added a few new Canon AFAreaMode values (thanks Wernfried)
29
+ - Added config_files/onone.config to the distribution
30
+ - Decode timed accelerometer readings from NextBase 622GW videos
31
+ - Decode Pentax K-3III CameraOrentation (thanks Peter)
32
+ - Improved German translation for LensModel
33
+ - Enhanced the API StructFormat JSONQ setting to quote all JSON values, even
34
+ if they aren't in a structure
35
+ - Changed -geolocate option so specifying the Keys group writes
36
+ Keys:GPSPosition only if an input city is specified, and Keys:LocationName
37
+ only for input GPS coordinates
38
+ - Tweaked API Geolocation option recognized space-separated lat/lon even when
39
+ there is no decimal point in the numbers
40
+ - API Changes:
41
+ - Changed LargeFileSupport default to 2 and added a warning if a large
42
+ chunk is encountered. Set to 1 to avoid the warning.
43
+
44
+ June 13, 2024 - Version 12.87
45
+
46
+ - Added ability to write Google Container XMP tags (using the namespace prefix
47
+ 'GContainer' to avoid conflict with the Google Device Container prefix)
48
+ - Decode a few new tags for the Canon EOS R5 (thanks John Moyer)
49
+ - Decode battery information for the Pentax K-3 III (thanks Peter)
50
+ - Decode RAFCompression from FujiFilm RAF images (thanks Albert Shan)
51
+ - Avoid reporting FileSize for pipes
52
+ - Updated Geolocation databases from current geonames.org files
53
+ - Enhanced Geolocation feature to allow lat/lon to be input with a space
54
+ separator instead of a comma
55
+ - Skip over Matroska Cluster if necessary to read Tags when referenced from
56
+ SeekHead
57
+ - Changed conversion for Matroska SeekID (now in hex with tag name in
58
+ brackets) and SeekPosition (now returns an absolute offset)
59
+ - Fixed problem writing XMP-Device:EarthPos coordinates
60
+ - Fixed typo in a value of Canon:DigitalLensOptimizer (thanks Martin B.)
61
+ - Fixed decoding of Matroska VideoScanType
62
+ - Fixed misleading error message when -o option was used to write to an
63
+ unsupported file type
64
+
65
+ June 7, 2024 - Version 12.86
66
+
67
+ - Added a new value for a couple of Olympus tags (thanks Herb)
68
+ - Improved handling of ID3 user-defined tags
69
+ - Decode all JPEG segments from RICO box in Ricoh MOV videos
70
+ - Decode a few new values for some tags written by Canon EOS R cameras (thanks
71
+ John Moyer and Martin B.)
72
+ - Patched some Olympus WB_RBLevels tags to allow 4 values to be written as per
73
+ some newer models
74
+ - Fixed issue when writing IPTC date tags with a date/time value containing
75
+ subseconds with 4 or more digits
76
+
77
+ May 21, 2024 - Version 12.85
78
+
79
+ - Added GeolocationFeatureType tag
80
+ - Added read support for Nikon NKA and NXD adjustment files
81
+ - Added a new Apple:ImageCaptureType value, and changed another one
82
+ - Decode a few new Pentax tags
83
+ - Decode a few new Canon tags
84
+ - Decode some Ricoh Exif metadata from MOV videos
85
+ - Extract ID3 UserDefinedText and UserDefinedURL tags by name
86
+ - Make $advFmtSelf available for user-defined helper functions
87
+ - Documented API GeoDir pseudo option feature
88
+ - Tolerate pad byte at end of HIF file when writing
89
+ - Raised priority of FileName, BaseName, Directory and FileType tags so they
90
+ don't get hidden by other tags in the file which may have these names
91
+ - Changed decoding of QuickTime Rotation (irot) to correspond with
92
+ EXIF:Orientation (previously this was oddly reported as degrees of
93
+ counterclockwise rotation)
94
+ - Fixed a typo in the print conversion value for a couple of DPX tags
95
+ - Fixed problem writing some QuickTime tags with very large (> 16 MB) values
96
+ - Fixed bug in build_geolocation utility that resulted in incorrect population
97
+ numbers when run under ActivePerl
98
+
10
99
  Apr. 23, 2024 - Version 12.84
11
100
 
12
101
  - Added ability to read speed and accuracy_horizontal when geotagging from
13
102
  OpenTracks GPX files
14
103
  - Decode a few more Apple tags and a new CanonVRD tag
15
- - Enhanced Geolocation option with the ability to return any number of nearby
104
+ - Enhanced Geolocation feature with the ability to return any number of nearby
16
105
  cities
106
+ - Allow coordinates to be entered without comma separator for the Geolocation
107
+ feature as long as both coordinates have a decimal point
17
108
  - Fixed long-standing bug in Windows version that didn't properly handle dates
18
109
  older than 50 years when writing FileModifyDate or FileCreateDate
19
110
  - Fixed API TimeZone option to work in Windows
@@ -21,8 +112,8 @@ Apr. 23, 2024 - Version 12.84
21
112
  which have print conversions
22
113
  - Fixed problem where a new subregion couldn't be added through a user-defined
23
114
  Geolocation database entry
24
- - Fixed problem where GeolocFeature option didn't work for some features if a
25
- user-generated custom database was used
115
+ - Fixed problem where the API GeolocFeature option didn't work for some
116
+ features if a user-generated custom database was used
26
117
 
27
118
  Apr. 18, 2024 - Version 12.83
28
119
 
package/bin/MANIFEST CHANGED
@@ -28,6 +28,7 @@ config_files/frameCount.config
28
28
  config_files/gps2utm.config
29
29
  config_files/guano.config
30
30
  config_files/nksc.config
31
+ config_files/onone.config
31
32
  config_files/photoshop_paths.config
32
33
  config_files/picasa_faces.config
33
34
  config_files/pix4d.config
package/bin/META.json CHANGED
@@ -50,5 +50,5 @@
50
50
  }
51
51
  },
52
52
  "release_status" : "stable",
53
- "version" : "12.84"
53
+ "version" : "12.89"
54
54
  }
package/bin/META.yml CHANGED
@@ -3,32 +3,32 @@ abstract: 'Read and write meta information'
3
3
  author:
4
4
  - 'Phil Harvey (philharvey66 at gmail.com)'
5
5
  build_requires:
6
- ExtUtils::MakeMaker: 0
6
+ ExtUtils::MakeMaker: '0'
7
7
  configure_requires:
8
- ExtUtils::MakeMaker: 0
8
+ ExtUtils::MakeMaker: '0'
9
9
  dynamic_config: 0
10
10
  generated_by: 'ExtUtils::MakeMaker version 7.34, CPAN::Meta::Converter version 2.143240, CPAN::Meta::Converter version 2.133380'
11
11
  license: perl
12
12
  meta-spec:
13
13
  url: http://module-build.sourceforge.net/META-spec-v1.4.html
14
- version: 1.4
14
+ version: '1.4'
15
15
  name: Image-ExifTool
16
16
  no_index:
17
17
  directory:
18
18
  - t
19
19
  - inc
20
20
  recommends:
21
- Archive::Zip: 0
22
- Compress::Raw::Lzma: 0
23
- Compress::Zlib: 0
24
- Digest::MD5: 0
25
- Digest::SHA: 0
26
- IO::Compress::Brotli: 0
27
- IO::Compress::RawDeflate: 0
28
- IO::Uncompress::Brotli: 0
29
- IO::Uncompress::RawInflate: 0
30
- POSIX::strptime: 0
31
- Time::HiRes: 0
21
+ Archive::Zip: '0'
22
+ Compress::Raw::Lzma: '0'
23
+ Compress::Zlib: '0'
24
+ Digest::MD5: '0'
25
+ Digest::SHA: '0'
26
+ IO::Compress::Brotli: '0'
27
+ IO::Compress::RawDeflate: '0'
28
+ IO::Uncompress::Brotli: '0'
29
+ IO::Uncompress::RawInflate: '0'
30
+ POSIX::strptime: '0'
31
+ Time::HiRes: '0'
32
32
  requires:
33
- perl: 5.004
34
- version: 12.84
33
+ perl: '5.004'
34
+ version: '12.89'
package/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.84.tar.gz | tar -xf -
113
- cd Image-ExifTool-12.84
112
+ gzip -dc Image-ExifTool-12.89.tar.gz | tar -xf -
113
+ cd Image-ExifTool-12.89
114
114
  ./exiftool t/images/ExifTool.jpg
115
115
 
116
116
  Note: These commands extract meta information from one of the test images.
@@ -209,6 +209,7 @@ distribution package:
209
209
  gps2utm.config - Generate UTM coordinate tags from GPS info
210
210
  guano.config - Decode individual tags from Guano metadata
211
211
  nksc.config - Decode tags in Nikon ViewNX NKSC files
212
+ onone.config - Definitions for writing On1 XMP tags
212
213
  photoshop_paths.config - For extracting or copying Photoshop paths
213
214
  picasa_faces.config - Convert from Picasa to MWG/MP face regions
214
215
  pix4d.config - Definitions for writing Pix4D XMP tags
@@ -12,6 +12,10 @@
12
12
  # 2024-04-15 - PH Clean up and add options for public release
13
13
  # 2024-04-22 - PH Increased number of possible feature codes from
14
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
18
+ # 2024-06-13 - PH Tweaked case of imported feature types
15
19
  #
16
20
  # Notes: Requires these files from https://download.geonames.org/export/
17
21
  #
@@ -19,6 +23,7 @@
19
23
  # countryInfo.txt
20
24
  # admin1CodesASCII.txt
21
25
  # admin2Codes.txt
26
+ # featureCodes_XX.txt (optional)
22
27
  # alternateNamesV2.txt (optional)
23
28
  #
24
29
  # Output datbase format (Geolocation.dat):
@@ -54,7 +59,7 @@
54
59
  # 1. Time zone name, terminated by newline
55
60
  # "\0\0\0\0\x05" (feature codes added in v1.03)
56
61
  # Feature codes:
57
- # 1. Feature code, terminated by newline
62
+ # 1. Feature code, optional space-followed-by-feature-name, then newline
58
63
  # "\0\0\0\0\0"
59
64
  #
60
65
  # Feature Codes v1.02: (see http://www.geonames.org/export/codes.html#P for descriptions)
@@ -68,12 +73,12 @@
68
73
 
69
74
  use strict;
70
75
 
71
- my $dbVer = '1.02'; # database version
72
-
76
+ my $dbVer = '1.03'; # default output database version
73
77
  my $dbFile = 'allCountries.txt'; # default database file
74
78
  my $countryFile = 'countryInfo.txt'; # mandatory country names file
75
79
  my $regionFile = 'admin1CodesASCII.txt'; # mandatory region names file
76
80
  my $admin2File = 'admin2Codes.txt'; # mandatory subregion names file
81
+ my $featureFile = 'featureCodes_en.txt'; # optional feature names file
77
82
  my $altNamesFile = 'alternateNamesV2.txt'; # optional alternate names file
78
83
  my $outFile = 'Geolocation.dat'; # output ExifTool database file
79
84
  my $outAltNames = 'AltNames.dat'; # output alternate names file
@@ -103,6 +108,7 @@ my @fc103 = qw(
103
108
  my $i = 0;
104
109
  my @featureCodes = $dbVer eq '1.02' ? @fc102 : @fc103;
105
110
  my %featureCodes = map { $_ => $i++ } @featureCodes;
111
+ my %featureNames;
106
112
 
107
113
  my ($dbfile, @dbfiles, $outDir, $verbose, $noLang, %needRgn);
108
114
  my %optArgs = ( p => 1, c => 1, cp => 1, l => 1, o => 1, ver => 1 );
@@ -203,8 +209,9 @@ Syntax: build_geolocation [OPTIONS] [DBFILE] ...
203
209
  Options:
204
210
  DBFILE - Input database file name or directory. Multiple input database
205
211
  files may be specified. The -p, -c and -cp options apply to
206
- the database that comes after them on the command line.
207
- Default is "$dbFile".
212
+ the database that comes after them on the command line. The
213
+ other input files are assumed to be in the same directory as
214
+ the first database file. Default is "$dbFile".
208
215
  -p POP - Minimum population for cities to include. POP may be a number
209
216
  or be of the form "CC[,C2...]=###" to set different limits for
210
217
  specific countries/regions, where CC and C2 are country codes
@@ -240,12 +247,13 @@ Options:
240
247
  -h - Show this help.
241
248
 
242
249
  Input files (download from https://download.geonames.org/export/dump/):
243
- allCountries.txt - default database file (smaller files with names
250
+ $dbFile - default database file (smaller files with names
244
251
  like "cities###.txt" may be specified instead)
245
- countryInfo.txt - mandatory country names file
246
- admin1CodesASCII.txt - mandatory region names file
247
- admin2Codes.txt - mandatory subregion names file
248
- alternateNamesV2.txt - optional alternate names file (must exist to
252
+ $countryFile - mandatory country names file
253
+ $regionFile - mandatory region names file
254
+ $admin2File - mandatory subregion names file
255
+ $featureFile - optional feature codes file(s)
256
+ $altNamesFile - optional alternate names file (must exist to
249
257
  to generate $outAltNames and $geoLang files)
250
258
 
251
259
  Output files:
@@ -374,7 +382,7 @@ my @supportedLangs = qw(cs de en-ca en-gb es fi fr it ja ko nl pl ru sk sv tr zh
374
382
 
375
383
  # supported country-specific languages
376
384
  my %ccLang = ( TW => 'zh', CN => 'zh', CA => 'en', GB => 'en' );
377
- my (%lang, %haveCountry, %cityFlags, %rgnFlags, %subFlags, %ccFlags, %flags);
385
+ my (%lang, %featureLang, %haveCountry, %cityFlags, %rgnFlags, %subFlags, %ccFlags, %flags);
378
386
  my (%haveRegion, %haveSubRgn, $filesize, $percent);
379
387
 
380
388
  sub GetFileSize($)
@@ -386,7 +394,8 @@ sub GetFileSize($)
386
394
  return $size;
387
395
  }
388
396
 
389
- # pre-scan database to determine which countries, regions and subregions we will be using
397
+ # pre-scan database to determine which countries, regions subregions and
398
+ # feature codes we will be using
390
399
  foreach $dbfile (@dbfiles) {
391
400
  my $database = $$dbfile{file};
392
401
  my $upgraded;
@@ -422,7 +431,7 @@ foreach $dbfile (@dbfiles) {
422
431
  }
423
432
  # keep regardless of population
424
433
  if ($needRgn{$cc} and $$dbfile{keep}{"$cc$rgn"}) {
425
- $keep = $$dbfile{keep}{"$cc$rgn"}{$code};#TEST
434
+ $keep = $$dbfile{keep}{"$cc$rgn"}{$code};
426
435
  } elsif ($$dbfile{keep}{$cc}) {
427
436
  $keep = $$dbfile{keep}{$cc}{$code};
428
437
  } else {
@@ -462,9 +471,28 @@ foreach $dbfile (@dbfiles) {
462
471
  warn "Some feature codes not supported by version 1.02, writing as 1.03 instead.\n" if $upgraded;
463
472
  }
464
473
 
474
+ # read feature names
475
+ if (open INFILE, '<', "$dbdir/$featureFile") {
476
+ print "Reading $dbdir/$featureFile\n";
477
+ while (<INFILE>) {
478
+ my @items = split /\t/;
479
+ $items[0] =~ s/^.\.//; # remove feature group and "." separator
480
+ next unless $featureCodes{$items[0]};
481
+ my $name = ucfirst $items[1];
482
+ $name =~ s/ ([a-z])/ \U$1/g;
483
+ $name =~ s/(.)\b(Of|Or|A|An|On|In|The|By|For|And)\b/$1\L$2/g;
484
+ $featureNames{$items[0]} = $name;
485
+ }
486
+ close INFILE;
487
+ } else {
488
+ print "Not found: $dbdir/$featureFile\n";
489
+ print "--> Not storing feature type names\n";
490
+ }
491
+
465
492
  # read country names
466
493
  $i = 0;
467
494
  open INFILE, '<', "$dbdir/$countryFile" or die "Error opening $dbdir/$countryFile\n";
495
+ print "Reading $dbdir/$countryFile\n";
468
496
  while (<INFILE>) {
469
497
  next if /^#/;
470
498
  my @items = split /\t/;
@@ -479,6 +507,7 @@ die "Too many countries!\n" if $i > 0x100; # (no default 0 entry)
479
507
  # read region (admin1) names
480
508
  $i = 0;
481
509
  open REGION, '<', "$dbdir/$regionFile" or die "Error opening $dbdir/$regionFile\n";
510
+ print "Reading $dbdir/$regionFile\n";
482
511
  while (<REGION>) {
483
512
  chomp;
484
513
  my @items = split /\t/;
@@ -494,6 +523,7 @@ die "Too many regions!\n" if $i > 0x0fff; # (account for default 0 entry)
494
523
  # read subregion (admin2) names
495
524
  $i = 0;
496
525
  open ADMIN2, '<', "$dbdir/$admin2File" or die "Error opening $dbdir/$admin2File\n";
526
+ print "Reading $dbdir/$admin2File\n";
497
527
  while (<ADMIN2>) {
498
528
  chomp;
499
529
  my @items = split /\t/;
@@ -544,8 +574,35 @@ if (not $noLang and open INFILE, '<', "$dbdir/$altNamesFile") {
544
574
  }
545
575
  print "\b\b\b\bDone.\n";
546
576
  close INFILE;
577
+ # read alternate feature names
578
+ if (%featureNames) {
579
+ my $lng;
580
+ foreach $lng (@languages) {
581
+ next if $lng eq 'en' or not $languages{$lng};
582
+ my $file = "$dbdir/$featureFile";
583
+ $file =~ s/_en\./_$lng./ or next;
584
+ next unless open INFILE, '<', $file;
585
+ print "Reading $file\n";
586
+ while (<INFILE>) {
587
+ my @items = split /\t/;
588
+ $items[0] =~ s/^.\.//; # remove feature group and "." separator
589
+ next unless $featureNames{$items[0]};
590
+ utf8::decode($items[1]);
591
+ my $name = ucfirst $items[1];
592
+ $name =~ s/ (.)/ \U$1/g;
593
+ # change $name back to byte string
594
+ if ($] >= 5.006 and (eval { require Encode; Encode::is_utf8($name) } or $@)) {
595
+ $name = $@ ? pack('C*',unpack($] < 5.010000 ? 'U0C*' : 'C0C*',$name)) : Encode::encode('utf8',$name);
596
+ }
597
+ next if $name eq $featureNames{$items[0]};
598
+ $featureLang{$lng}{$items[0]} = $name;
599
+ }
600
+ close INFILE;
601
+ }
602
+ }
547
603
  } else {
548
- print "Not writing alternate languages ($dbdir/$altNamesFile not found)\n";
604
+ print "Not found: $dbdir/$altNamesFile\n--> " unless $noLang;
605
+ print "Not writing alternate languages\n";
549
606
  $noLang = 1;
550
607
  }
551
608
 
@@ -554,7 +611,7 @@ my (%coords, %langLookups);
554
611
  foreach $dbfile (@dbfiles) {
555
612
  my $database = $$dbfile{file};
556
613
 
557
- print "Processing $database... 0%";
614
+ print "Processing database entries... 0%";
558
615
  my $i = 0;
559
616
  my $num = scalar @{$$dbfile{kept}};
560
617
 
@@ -623,6 +680,7 @@ foreach (sort { $a cmp $b } keys %coords) {
623
680
  my $items = $coords{$_};
624
681
  # @$items=(0.lat,1.lon,2.city,3.cc,4.rgn,5.admin2,6.population,7.timezone,8.feature code,9.alt names)
625
682
  my $iCC = $orderCC{$$items[3]};
683
+ defined $iCC or warn("Unknown country code $$items[3]\n"), next;
626
684
  my $iRgn = $orderRgn{"$$items[3]$$items[4]"} || 0;
627
685
  my $iSub = $orderSub{"$$items[3]$$items[4].$$items[5]"} || 0;
628
686
  my $tn = $tz{$$items[7]};
@@ -631,9 +689,12 @@ foreach (sort { $a cmp $b } keys %coords) {
631
689
  $tn = $tz{$$items[7]} = $tzNum++;
632
690
  }
633
691
  # convert population to our binary format
634
- my $pop = sprintf('%.1e',$$items[6]); # format: "3.1e+04"
692
+ # Note: format in ActivePerl is "3.1e+004", but "3.1+04" in other Perls,
693
+ # but other Perls will round 34500 to "3.4e+04", so add 1 to get "3.5e+04"
694
+ $$items[6] += 1 if $$items[6] > 100 and not $$items[6] % 10;
695
+ my $pop = sprintf('%.1e',$$items[6]);
635
696
  # pack CC, population and region index into a 32-bit integer
636
- my $code = ($iCC << 24) | (substr($pop,6,1)<<20) | (substr($pop,0,1)<<16) | (substr($pop,2,1)<<12) | $iRgn;
697
+ my $code = ($iCC << 24) | (substr($pop,-1,1)<<20) | (substr($pop,0,1)<<16) | (substr($pop,2,1)<<12) | $iRgn;
637
698
  $fcodes{$$items[8]} = ($fcodes{$$items[8]} || 0) + 1;
638
699
  my $fc = $featureCodes{$$items[8]} || 0;
639
700
  # store high bit of timezone index
@@ -761,8 +822,12 @@ print OUTFILE $_,"\n" foreach @tz;
761
822
 
762
823
  print OUTFILE "\0\0\0\0\x05\n"; # section terminator
763
824
 
764
- # write feature codes
765
- print OUTFILE $_,"\n" foreach @featureCodes;
825
+ # write feature codes and optional names
826
+ foreach (@featureCodes) {
827
+ print OUTFILE $_;
828
+ print OUTFILE ' ', $featureNames{$_} if $featureNames{$_};
829
+ print OUTFILE "\n";
830
+ }
766
831
 
767
832
  # write terminator and close Geolocation.dat
768
833
  print OUTFILE "\0\0\0\0\0\n"; # file terminator
@@ -774,7 +839,9 @@ my $langSize = 0;
774
839
  my $langDir = "$outDir/$geoLang";
775
840
  # delete existing languages
776
841
  unlink <"$langDir/*.pm">;
777
- unless ($noLang) {
842
+ if ($noLang) {
843
+ rmdir $langDir;
844
+ } else {
778
845
  my $n = scalar(keys %langLookups);
779
846
  print "Writing $n language files to $outDir/$geoLang...\n";
780
847
  mkdir $langDir, 0777;
@@ -785,6 +852,7 @@ unless ($noLang) {
785
852
  my $lkup = $langLookups{$lng};
786
853
  my $file = "$myLng.pm";
787
854
  open OUT, ">$langDir/$file" or die "Error creating $file\n";
855
+ binmode OUT;
788
856
  print OUT "# Geolocation language translations for $myLng\n";
789
857
  print OUT "#\n# Based on Creative Commons database from geonames.org\n\n";
790
858
  print OUT "%Image::ExifTool::GeoLang::${myLng}::Translate = (\n";
@@ -842,6 +910,14 @@ unless ($noLang) {
842
910
  }
843
911
  }
844
912
  }
913
+ if ($featureLang{$lng}) {
914
+ print OUT "\n\t# feature types\n";
915
+ foreach (sort keys %{$featureLang{$lng}}) {
916
+ my $ftype = $featureLang{$lng}{$_};
917
+ $ftype =~ s/'/\\'/g;
918
+ print OUT "\t$_ => '$ftype',\n"
919
+ }
920
+ }
845
921
  print OUT ");\n\n1; #end\n";
846
922
  $langSize += tell OUT;
847
923
  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 = (
@@ -0,0 +1,28 @@
1
+ #------------------------------------------------------------------------------
2
+ # File: onone.config
3
+ #
4
+ # Description: This config file defines On1 XMP tags for writing.
5
+ #
6
+ # Usage: exiftool -config onone.config -UserFlag=VALUE FILE ...
7
+ #
8
+ # Requires: ExifTool version 10.28 or later
9
+ #
10
+ # Revisions: 2024/07/10 - P. Harvey Created
11
+ #------------------------------------------------------------------------------
12
+
13
+ %Image::ExifTool::UserDefined = (
14
+ 'Image::ExifTool::XMP::Main' => {
15
+ onone => {
16
+ SubDirectory => { TagTable => 'Image::ExifTool::UserDefined::onone' },
17
+ },
18
+ },
19
+ );
20
+
21
+ %Image::ExifTool::UserDefined::onone = (
22
+ GROUPS => { 0 => 'XMP', 1 => 'XMP-onone', 2 => 'Other' },
23
+ NAMESPACE => { 'onone' => 'http://www.ononesoftware.com/vcb/1.0/' },
24
+ WRITABLE => 'string',
25
+ UserFlag => { },
26
+ );
27
+
28
+ 1; #end