mini_exiftool 2.14.0 → 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 +4 -0
- data/Tutorial.md +1 -1
- data/lib/mini_exiftool.rb +24 -35
- 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,7 @@
|
|
|
1
|
+
2.15.0
|
|
2
|
+
- Fix security issue using string concatenation with Open3. Thanks to Sang
|
|
3
|
+
Nguyễn for reporting.
|
|
4
|
+
|
|
1
5
|
2.14.0
|
|
2
6
|
- Change default pstore_dir to subdir in Gem.cache_home or under USERPROFILE
|
|
3
7
|
or Dir.tmpdir if some not defined. So it's now XDG conform and also Ruby
|
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
|
|
@@ -391,15 +390,15 @@ class MiniExiftool
|
|
|
391
390
|
private
|
|
392
391
|
############################################################################
|
|
393
392
|
|
|
394
|
-
def cmd_gen
|
|
395
|
-
[
|
|
393
|
+
def cmd_gen arg_arr=[], filename
|
|
394
|
+
[@@cmd, *arg_arr.map {|s| s.encode('UTF-8')}, filename.encode(@@fs_enc)]
|
|
396
395
|
end
|
|
397
396
|
|
|
398
397
|
def run cmd
|
|
399
398
|
if $DEBUG
|
|
400
|
-
$stderr.puts cmd
|
|
399
|
+
$stderr.puts cmd.inspect
|
|
401
400
|
end
|
|
402
|
-
status = Open3.popen3(cmd) do |inp, out, err, thr|
|
|
401
|
+
status = Open3.popen3(*cmd) do |inp, out, err, thr|
|
|
403
402
|
if @io
|
|
404
403
|
begin
|
|
405
404
|
IO.copy_stream @io, inp
|
|
@@ -542,21 +541,11 @@ class MiniExiftool
|
|
|
542
541
|
tags
|
|
543
542
|
end
|
|
544
543
|
|
|
545
|
-
if @@running_on_windows
|
|
546
|
-
def escape val
|
|
547
|
-
'"' << val.to_s.gsub(/([\\"`])/, "\\\\\\1") << '"'
|
|
548
|
-
end
|
|
549
|
-
else
|
|
550
|
-
def escape val
|
|
551
|
-
'"' << val.to_s.gsub(/([\\"$`])/, "\\\\\\1") << '"'
|
|
552
|
-
end
|
|
553
|
-
end
|
|
554
|
-
|
|
555
544
|
def generate_encoding_params
|
|
556
|
-
params =
|
|
545
|
+
params = []
|
|
557
546
|
@@encoding_types.each do |enc_type|
|
|
558
547
|
if enc_val = @opts[MiniExiftool.encoding_opt(enc_type)]
|
|
559
|
-
params <<
|
|
548
|
+
params << '-charset' << "#{enc_type}=#{enc_val}"
|
|
560
549
|
end
|
|
561
550
|
end
|
|
562
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: []
|