mini_exiftool 1.6.0 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1d1b5a3906b34606e231c3ffda6a4df3d5a6026b
4
+ data.tar.gz: 9e63ae2193c37ab53810d371fae213200babb0e9
5
+ SHA512:
6
+ metadata.gz: ff0a627dd02d2e7b42aa38094c591d688c7d352795f704e96c0e405215f468708472ea3f11365c46f3268615fc1825a72019a0862e2a13b54005047643cfbd04
7
+ data.tar.gz: 671b31da0a3925b287d2bc688292d706f00d12206384e8cbaf06a952ad86f96804a4ed8a3e79a3b0e8b0bfd2680e67e3b5d80feebb743c4908f089e622ff969d
data/Changelog CHANGED
@@ -1,3 +1,11 @@
1
+ 1.7.0
2
+ - Support exiftool -c option for formatting GPS
3
+ coordinates.
4
+ Thanks to Lee Horrocks for the patch.
5
+ - Switching from shellwords to manual escaping.
6
+ Hopefully it works now on Windows systems.
7
+ Thanks to uwe58 and jpg0 for the hints.
8
+
1
9
  1.6.0
2
10
  - Type conversion in MiniExiftool.from_hash.
3
11
  Thanks to Ethan Soutar-Rau for the merge request.
@@ -10,6 +10,11 @@ An installation of the Exiftool command-line application.
10
10
  Instructions for installation you can find under
11
11
  http://www.sno.phy.queensu.ca/~phil/exiftool/install.html .
12
12
 
13
+ Alternatively Wil Gieseler has bundled a meta-gem that eliminates the
14
+ need for a seperate Exiftool installation. Have a look at
15
+ http://github.com/wilg/mini_exiftool_vendored or
16
+ http://rubygems.org/gems/mini_exiftool_vendored .
17
+
13
18
  == Installation
14
19
 
15
20
  First you need Exiftool (see under Requirements above). Then you can simply
@@ -18,7 +18,6 @@ require 'tempfile'
18
18
  require 'pstore'
19
19
  require 'rational'
20
20
  require 'set'
21
- require 'shellwords'
22
21
  require 'time'
23
22
 
24
23
  # Simple OO access to the Exiftool command-line application.
@@ -33,7 +32,7 @@ class MiniExiftool
33
32
  attr_reader :filename
34
33
  attr_accessor :numerical, :composite, :convert_encoding, :ignore_minor_errors, :errors, :timestamps
35
34
 
36
- VERSION = '1.6.0'
35
+ VERSION = '1.7.0'
37
36
 
38
37
  # +opts+ support at the moment
39
38
  # * <code>:numerical</code> for numerical values, default is +false+
@@ -56,6 +55,7 @@ class MiniExiftool
56
55
  @convert_encoding = opts[:convert_encoding]
57
56
  @ignore_minor_errors = opts[:ignore_minor_errors]
58
57
  @timestamps = opts[:timestamps]
58
+ @coord_format = opts[:coord_format]
59
59
  @values = TagHash.new
60
60
  @tag_names = TagHash.new
61
61
  @changed_values = TagHash.new
@@ -88,7 +88,8 @@ class MiniExiftool
88
88
  opt_params << (@numerical ? '-n ' : '')
89
89
  opt_params << (@composite ? '' : '-e ')
90
90
  opt_params << (@convert_encoding ? '-L ' : '')
91
- cmd = %Q(#@@cmd -q -q -s -t #{opt_params} #{@@sep_op} #{Shellwords.escape(filename)})
91
+ opt_params << (@coord_format ? "-c \"#{@coord_format}\"" : '')
92
+ cmd = %Q(#@@cmd -q -q -s -t #{opt_params} #{@@sep_op} #{MiniExiftool.escape(filename)})
92
93
  if run(cmd)
93
94
  parse_output
94
95
  else
@@ -160,7 +161,7 @@ class MiniExiftool
160
161
  arr_val.map! {|e| convert e}
161
162
  tag_params = ''
162
163
  arr_val.each do |v|
163
- tag_params << %Q(-#{original_tag}=#{Shellwords.escape(v.to_s)} )
164
+ tag_params << %Q(-#{original_tag}=#{MiniExiftool.escape(v)} )
164
165
  end
165
166
  opt_params = ''
166
167
  opt_params << (arr_val.detect {|x| x.kind_of?(Numeric)} ? '-n ' : '')
@@ -440,6 +441,9 @@ class MiniExiftool
440
441
  tags
441
442
  end
442
443
 
444
+ def self.escape(val)
445
+ '"' << val.to_s.gsub(/\\/, '\\'*4).gsub(/"/, '\"') << '"'
446
+ end
443
447
 
444
448
  # Hash with indifferent access:
445
449
  # DateTimeOriginal == datetimeoriginal == date_time_original
@@ -0,0 +1,18 @@
1
+ # -- encoding: utf-8 --
2
+ require 'helpers_for_test'
3
+
4
+ class TestReadCoordinates < TestCase
5
+
6
+ def setup
7
+ @data_dir = File.dirname(__FILE__) + '/data'
8
+ @filename_test = @data_dir + '/test_coordinates.jpg'
9
+ end
10
+
11
+ def test_access_coordinates
12
+ mini_exiftool_coord = MiniExiftool.new @filename_test, :coord_format => "%+.6f"
13
+ assert_equal '+43.653167', mini_exiftool_coord['GPSLatitude']
14
+ assert_equal '-79.373167', mini_exiftool_coord['GPSLongitude']
15
+ assert_equal '+43.653167, -79.373167', mini_exiftool_coord['GPSPosition']
16
+ end
17
+
18
+ end
metadata CHANGED
@@ -1,32 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mini_exiftool
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
5
- prerelease:
4
+ version: 1.7.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Jan Friedrich
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-07-09 00:00:00.000000000 Z
11
+ date: 2013-05-07 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rim
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
21
- version: 1.6.1
19
+ version: 1.6.2
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
29
- version: 1.6.1
26
+ version: 1.6.2
30
27
  description: ''
31
28
  email: janfri26@gmail.com
32
29
  executables: []
@@ -43,6 +40,7 @@ files:
43
40
  - test/data/INFORMATION
44
41
  - test/data/test.jpg
45
42
  - test/data/test.jpg.json
43
+ - test/data/test_coordinates.jpg
46
44
  - test/data/test_special_dates.jpg
47
45
  - test/helpers_for_test.rb
48
46
  - test/test_bad_preview_ifd.rb
@@ -51,6 +49,7 @@ files:
51
49
  - test/test_dumping.rb
52
50
  - test/test_from_hash.rb
53
51
  - test/test_read.rb
52
+ - test/test_read_coordinates.rb
54
53
  - test/test_read_numerical.rb
55
54
  - test/test_save.rb
56
55
  - test/test_special.rb
@@ -58,7 +57,8 @@ files:
58
57
  - test/test_write.rb
59
58
  homepage: http://gitorious.org/mini_exiftool
60
59
  licenses: []
61
- post_install_message: ! "\n+-----------------------------------------------------------------------+\n|
60
+ metadata: {}
61
+ post_install_message: "\n+-----------------------------------------------------------------------+\n|
62
62
  Please ensure you have installed exiftool and it's found in your PATH |\n| (Try
63
63
  \"exiftool -ver\" on your commandline). For more details see |\n| http://www.sno.phy.queensu.ca/~phil/exiftool/install.html
64
64
  \ |\n+-----------------------------------------------------------------------+\n
@@ -67,21 +67,19 @@ rdoc_options: []
67
67
  require_paths:
68
68
  - lib
69
69
  required_ruby_version: !ruby/object:Gem::Requirement
70
- none: false
71
70
  requirements:
72
- - - ! '>='
71
+ - - '>='
73
72
  - !ruby/object:Gem::Version
74
73
  version: '0'
75
74
  required_rubygems_version: !ruby/object:Gem::Requirement
76
- none: false
77
75
  requirements:
78
- - - ! '>='
76
+ - - '>='
79
77
  - !ruby/object:Gem::Version
80
78
  version: '0'
81
79
  requirements: []
82
80
  rubyforge_project:
83
- rubygems_version: 1.8.23
81
+ rubygems_version: 2.0.2
84
82
  signing_key:
85
- specification_version: 3
83
+ specification_version: 4
86
84
  summary: This library is wrapper for the Exiftool command-line application (http://www.sno.phy.queensu.ca/~phil/exiftool).
87
85
  test_files: []