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 +4 -4
- data/bin/Changes +51 -1
- data/bin/META.json +1 -1
- data/bin/META.yml +1 -1
- data/bin/README +46 -46
- data/bin/build_geolocation +99 -21
- data/bin/config_files/example.config +7 -2
- data/bin/exiftool +52 -50
- data/bin/lib/Image/ExifTool/Apple.pm +52 -7
- data/bin/lib/Image/ExifTool/BuildTagLookup.pm +3 -2
- data/bin/lib/Image/ExifTool/Canon.pm +38 -4
- data/bin/lib/Image/ExifTool/CanonVRD.pm +17 -2
- data/bin/lib/Image/ExifTool/DPX.pm +3 -3
- data/bin/lib/Image/ExifTool/Geolocation.dat +0 -0
- data/bin/lib/Image/ExifTool/Geolocation.pm +132 -79
- data/bin/lib/Image/ExifTool/Geotag.pm +18 -10
- data/bin/lib/Image/ExifTool/ID3.pm +36 -8
- data/bin/lib/Image/ExifTool/Nikon.pm +19 -1
- data/bin/lib/Image/ExifTool/Olympus.pm +27 -17
- data/bin/lib/Image/ExifTool/Pentax.pm +64 -13
- data/bin/lib/Image/ExifTool/QuickTime.pm +28 -9
- data/bin/lib/Image/ExifTool/Samsung.pm +29 -1
- data/bin/lib/Image/ExifTool/TagLookup.pm +3550 -3539
- data/bin/lib/Image/ExifTool/TagNames.pod +51 -22
- data/bin/lib/Image/ExifTool/WriteIPTC.pl +1 -1
- data/bin/lib/Image/ExifTool/WriteQuickTime.pl +2 -1
- data/bin/lib/Image/ExifTool/Writer.pl +5 -5
- data/bin/lib/Image/ExifTool/XMP.pm +2 -0
- data/bin/lib/Image/ExifTool.pm +91 -49
- data/bin/lib/Image/ExifTool.pod +61 -51
- data/bin/perl-Image-ExifTool.spec +45 -45
- data/lib/exiftool_vendored/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 545516d00429f2217884ee7dd4339504e84b836ee2b778fa44707a637bc4184c
|
4
|
+
data.tar.gz: a3737fb33959d687603b58ec0062ae907853bbae9bcc856ca10d1ac560368658
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
data/bin/META.yml
CHANGED
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 |
|
18
|
-
3FR r | DPX r | J2C r |
|
19
|
-
3G2 r/w | DR4 r/w/c | JNG r/w |
|
20
|
-
3GP r/w | DSS r | JP2 r/w |
|
21
|
-
7Z r | DV r | JPEG r/w |
|
22
|
-
A r | DVB r/w | JSON r |
|
23
|
-
AA r | DVR-MS r | JXL r/w |
|
24
|
-
AAC r | DYLIB r | K25 r |
|
25
|
-
AAE r | EIP r | KDC r |
|
26
|
-
AAX r/w | EPS r/w | KEY r |
|
27
|
-
ACR r | EPUB r | LA r |
|
28
|
-
AFM r | ERF r/w | LFP r |
|
29
|
-
AI r/w | EXE r | LIF r |
|
30
|
-
AIFF r | EXIF r/w/c | LNK r |
|
31
|
-
APE r | EXR r | LRV r/w |
|
32
|
-
ARQ r/w | EXV r/w/c | M2TS r |
|
33
|
-
ARW r/w | F4A/V r/w | M4A/V r/w |
|
34
|
-
ASF r | FFF r/w | MACOS r |
|
35
|
-
AVI r | FITS r | MAX r |
|
36
|
-
AVIF r/w | FLA r | MEF r/w |
|
37
|
-
AZW r | FLAC r | MIE r/w/c |
|
38
|
-
BMP r | FLIF r/w | MIFF r |
|
39
|
-
BPG r | FLV r | MKA r |
|
40
|
-
BTF r | FPF r | MKS r |
|
41
|
-
C2PA r | FPX r | MKV r |
|
42
|
-
CHM r | GIF r/w | MNG r/w |
|
43
|
-
COS r | GLV r/w | MOBI r |
|
44
|
-
CR2 r/w | GPR r/w | MODD r |
|
45
|
-
CR3 r/w | GZ r | MOI r |
|
46
|
-
CRM r/w | HDP r/w | MOS r/w |
|
47
|
-
CRW r/w | HDR r | MOV r/w |
|
48
|
-
CS1 r/w | HEIC r/w | MP3 r |
|
49
|
-
CSV r | HEIF r/w | MP4 r/w |
|
50
|
-
CUR r | HTML r | MPC r |
|
51
|
-
CZI r | ICC r/w/c | MPG r |
|
52
|
-
DCM r | ICO r | MPO r/w |
|
53
|
-
DCP r/w | ICS r | MQV r/w |
|
54
|
-
DCR r | IDML r | MRC r |
|
55
|
-
DFONT r | IIQ r/w | MRW r/w |
|
56
|
-
DIVX r | IND r/w | MXF r |
|
57
|
-
DJVU r | INSP r/w | NEF r/w |
|
58
|
-
DLL r | INSV r |
|
59
|
-
DNG r/w | INX r |
|
60
|
-
DOC r | ISO 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.
|
113
|
-
cd Image-ExifTool-12.
|
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.
|
data/bin/build_geolocation
CHANGED
@@ -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 -
|
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,
|
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.
|
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
|
-
|
248
|
+
$dbFile - default database file (smaller files with names
|
239
249
|
like "cities###.txt" may be specified instead)
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
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
|
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}
|
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
|
441
|
-
unless ($featureCodes{$code} or @featureCodes >
|
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
|
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
|
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
|
-
|
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,
|
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
|
-
|
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
|
-
|
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,
|
368
|
-
['Sinemorets','
|
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
|
#------------------------------------------------------------------------------
|