mini_exiftool 2.13.1 → 2.15.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.
- checksums.yaml +4 -4
- data/Changelog +12 -0
- data/README.md +5 -2
- data/Tutorial.md +1 -1
- data/lib/mini_exiftool.rb +34 -39
- 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: 69630b2ee9bc16842745fc2a1d95dbe94a0a17304a1604f7187d5336b60afa7d
|
|
4
|
+
data.tar.gz: bcb202b7810e4605f4d8838ce67c835135a8ae84cd5c8d7cd12cb535a8ffd239
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 41d98a19c65f0910939f844ffd8fdcbbd2c45bff1631b7f71f242b99e3b58e0438878318c675887f74735b79d2b74fbcb9f93fcab29463cb0491b49ab1874af2
|
|
7
|
+
data.tar.gz: a16989012b6ea0bd5e718dc2d4b07ae9046ef8f1ef4614c0fb5cde36673aac819c32143cc3a9f58f21cd14046a57527650c75441259bb6469734d2efdb3bb26c
|
data/Changelog
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
2.15.0
|
|
2
|
+
- Fix security issue using string concatenation with Open3. Thanks to Sang
|
|
3
|
+
Nguyễn for reporting.
|
|
4
|
+
|
|
5
|
+
2.14.0
|
|
6
|
+
- Change default pstore_dir to subdir in Gem.cache_home or under USERPROFILE
|
|
7
|
+
or Dir.tmpdir if some not defined. So it's now XDG conform and also Ruby
|
|
8
|
+
ecosystem conform. Thanks a lot to Ryan Lue again for his effort and
|
|
9
|
+
support (github issue #51).
|
|
10
|
+
- Add the possibility to change the pstore_dir by setting the environment
|
|
11
|
+
variable MINI_EXIFTOOL_PSTORE_DIR.
|
|
12
|
+
|
|
1
13
|
2.13.1
|
|
2
14
|
- Second try to fix bug when using Pathname instances of filenames.
|
|
3
15
|
|
data/README.md
CHANGED
|
@@ -53,8 +53,11 @@ MiniExiftool.command = '/path/to/my/exiftool'
|
|
|
53
53
|
|
|
54
54
|
In addition, you can also tell MiniExiftool where to store the PStore files with tags
|
|
55
55
|
which exiftool supports. The PStore files are used for performance issues.
|
|
56
|
-
Per default the PStore files are stored in a sub directory
|
|
57
|
-
`
|
|
56
|
+
Per default the PStore files are stored in a sub directory `mini_exiftool` in
|
|
57
|
+
`Gem.cache' or if this is not defined under `USERPROFILE` or `Dir.tmpdir`.
|
|
58
|
+
|
|
59
|
+
You can change it by setting the environment variable
|
|
60
|
+
`MINI_EXIFTOOL_PSTORE_DIR` or programmatically, as follows.
|
|
58
61
|
|
|
59
62
|
```ruby
|
|
60
63
|
MiniExiftool.pstore_dir = '/path/to/pstore/dir'
|
data/Tutorial.md
CHANGED
|
@@ -147,7 +147,7 @@ puts photo['ISO']
|
|
|
147
147
|
|
|
148
148
|
The kind of the parameter `filename_or_io` is determined via duck typing:
|
|
149
149
|
if the argument responds to `to_str` it is interpreted as filename, if it
|
|
150
|
-
responds to `read` it is interpreted
|
|
150
|
+
responds to `read` it is interpreted as IO instance.
|
|
151
151
|
Attention: If you use an IO instance then writing of values is not supported!
|
|
152
152
|
|
|
153
153
|
Look at the show_speedup_with_fast_option example in the MiniExiftool examples
|
data/lib/mini_exiftool.rb
CHANGED
|
@@ -29,7 +29,7 @@ require 'yaml'
|
|
|
29
29
|
# Simple OO access to the ExifTool command-line application.
|
|
30
30
|
class MiniExiftool
|
|
31
31
|
|
|
32
|
-
VERSION = '2.
|
|
32
|
+
VERSION = '2.15.0'
|
|
33
33
|
|
|
34
34
|
# Name of the ExifTool command-line application
|
|
35
35
|
@@cmd = 'exiftool'
|
|
@@ -149,13 +149,13 @@ class MiniExiftool
|
|
|
149
149
|
end
|
|
150
150
|
@values.clear
|
|
151
151
|
@changed_values.clear
|
|
152
|
-
params =
|
|
153
|
-
params <<
|
|
154
|
-
params <<
|
|
155
|
-
params <<
|
|
156
|
-
params <<
|
|
157
|
-
params <<
|
|
158
|
-
params
|
|
152
|
+
params = %w(-j)
|
|
153
|
+
params << '-n' if @opts[:numerical]
|
|
154
|
+
params << '-e' unless @opts[:composite]
|
|
155
|
+
params << '-c' << @opts[:coord_format] if @opts[:coord_format]
|
|
156
|
+
params << '-fast' if @opts[:fast]
|
|
157
|
+
params << '-fast2' if @opts[:fast2]
|
|
158
|
+
params += generate_encoding_params
|
|
159
159
|
if run(cmd_gen(params, @filename))
|
|
160
160
|
parse_output
|
|
161
161
|
else
|
|
@@ -227,12 +227,12 @@ class MiniExiftool
|
|
|
227
227
|
original_tag = MiniExiftool.original_tag(tag)
|
|
228
228
|
arr_val = val.kind_of?(Array) ? val : [val]
|
|
229
229
|
arr_val.map! {|e| convert_before_save(e)}
|
|
230
|
-
params =
|
|
231
|
-
params <<
|
|
232
|
-
params <<
|
|
233
|
-
params
|
|
230
|
+
params = %w(-q -P -overwrite_original)
|
|
231
|
+
params << '-n' if arr_val.detect {|x| x.kind_of?(Numeric)}
|
|
232
|
+
params << '-m' if @opts[:ignore_minor_errors]
|
|
233
|
+
params += generate_encoding_params
|
|
234
234
|
arr_val.each do |v|
|
|
235
|
-
params <<
|
|
235
|
+
params << "-#{original_tag}=#{v}"
|
|
236
236
|
end
|
|
237
237
|
result = run(cmd_gen(params, temp_filename))
|
|
238
238
|
unless result
|
|
@@ -263,11 +263,10 @@ class MiniExiftool
|
|
|
263
263
|
unless File.exist?(source_filename)
|
|
264
264
|
raise MiniExiftool::Error.new("Source file #{source_filename} does not exist!")
|
|
265
265
|
end
|
|
266
|
-
params =
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
result = run(cmd)
|
|
266
|
+
params = %w(-q -P -overwrite_original -tagsFromFile)
|
|
267
|
+
params << source_filename.to_s.encode(@@fs_enc)
|
|
268
|
+
params += Array(tags).map {|t| "-#{t}"}
|
|
269
|
+
result = run(cmd_gen(params, filename))
|
|
271
270
|
reload
|
|
272
271
|
result
|
|
273
272
|
end
|
|
@@ -351,7 +350,7 @@ class MiniExiftool
|
|
|
351
350
|
|
|
352
351
|
# Returns the version of the ExifTool command-line application.
|
|
353
352
|
def self.exiftool_version
|
|
354
|
-
Open3.popen3
|
|
353
|
+
Open3.popen3(MiniExiftool.command, '-ver') do |_inp, out, _err, _thr|
|
|
355
354
|
out.read.chomp!
|
|
356
355
|
end
|
|
357
356
|
rescue SystemCallError
|
|
@@ -366,10 +365,16 @@ class MiniExiftool
|
|
|
366
365
|
|
|
367
366
|
def self.pstore_dir
|
|
368
367
|
unless defined? @@pstore_dir
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
368
|
+
@@pstore_dir =
|
|
369
|
+
if env = ENV['MINI_EXIFTOOL_PSTORE_DIR']
|
|
370
|
+
env
|
|
371
|
+
elsif defined?(Gem.cache_home) && File.writable?(Gem.cache_home)
|
|
372
|
+
File.join(Gem.cache_home, 'mini_exiftool')
|
|
373
|
+
else
|
|
374
|
+
# This fallback will hopefully work on *NIX and Windows systems
|
|
375
|
+
cache_dir = ENV['USERPROFILE'] || Dir.tmpdir
|
|
376
|
+
File.join(cache_dir, 'mini_exiftool')
|
|
377
|
+
end
|
|
373
378
|
end
|
|
374
379
|
@@pstore_dir
|
|
375
380
|
end
|
|
@@ -385,15 +390,15 @@ class MiniExiftool
|
|
|
385
390
|
private
|
|
386
391
|
############################################################################
|
|
387
392
|
|
|
388
|
-
def cmd_gen
|
|
389
|
-
[
|
|
393
|
+
def cmd_gen arg_arr=[], filename
|
|
394
|
+
[@@cmd, *arg_arr.map {|s| s.encode('UTF-8')}, filename.encode(@@fs_enc)]
|
|
390
395
|
end
|
|
391
396
|
|
|
392
397
|
def run cmd
|
|
393
398
|
if $DEBUG
|
|
394
|
-
$stderr.puts cmd
|
|
399
|
+
$stderr.puts cmd.inspect
|
|
395
400
|
end
|
|
396
|
-
status = Open3.popen3(cmd) do |inp, out, err, thr|
|
|
401
|
+
status = Open3.popen3(*cmd) do |inp, out, err, thr|
|
|
397
402
|
if @io
|
|
398
403
|
begin
|
|
399
404
|
IO.copy_stream @io, inp
|
|
@@ -536,21 +541,11 @@ class MiniExiftool
|
|
|
536
541
|
tags
|
|
537
542
|
end
|
|
538
543
|
|
|
539
|
-
if @@running_on_windows
|
|
540
|
-
def escape val
|
|
541
|
-
'"' << val.to_s.gsub(/([\\"`])/, "\\\\\\1") << '"'
|
|
542
|
-
end
|
|
543
|
-
else
|
|
544
|
-
def escape val
|
|
545
|
-
'"' << val.to_s.gsub(/([\\"$`])/, "\\\\\\1") << '"'
|
|
546
|
-
end
|
|
547
|
-
end
|
|
548
|
-
|
|
549
544
|
def generate_encoding_params
|
|
550
|
-
params =
|
|
545
|
+
params = []
|
|
551
546
|
@@encoding_types.each do |enc_type|
|
|
552
547
|
if enc_val = @opts[MiniExiftool.encoding_opt(enc_type)]
|
|
553
|
-
params <<
|
|
548
|
+
params << '-charset' << "#{enc_type}=#{enc_val}"
|
|
554
549
|
end
|
|
555
550
|
end
|
|
556
551
|
params
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mini_exiftool
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.15.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jan Friedrich
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: ostruct
|
|
@@ -143,7 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
143
143
|
version: '0'
|
|
144
144
|
requirements:
|
|
145
145
|
- exiftool, version >= 7,65
|
|
146
|
-
rubygems_version:
|
|
146
|
+
rubygems_version: 4.0.6
|
|
147
147
|
specification_version: 4
|
|
148
148
|
summary: This library is a wrapper for the ExifTool command-line application (https://exiftool.org).
|
|
149
149
|
test_files: []
|