multi_exiftool 0.10.0 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4c14256fd34812250504b309d7c3a3c9675c69f2e6da13e3001a557561ac3b1d
4
- data.tar.gz: c95ff092b037374f294afb75a6a892074576b4bbdf0aed8a083f994ffff82cfd
3
+ metadata.gz: ca498fb96cf61bd299f2c0d8b7219ad540e9a5b8cbc760c1244ad7d860d5acb2
4
+ data.tar.gz: adb0634ba2229c3b8c570ebc027a7ded120b8f94f1889cfaca5604aa3e40ec09
5
5
  SHA512:
6
- metadata.gz: 410889a498ece01c7b8181c05a8f6c2f3eb63fd4355e89f6978db1f541d1a86097ec576b35aafef47286dfc50ecc1026ff07dfe5d9857d6e5ab4452bc792804e
7
- data.tar.gz: 60a9ca8ef167f6b4ef8c8ac70b893243deb1c4291f9a5e4288619779403e2137cc0bfe6135e5beb2c35d0b910cbc83a071ac2b6812cc3c3defc00de40c38eac3
6
+ metadata.gz: dc19963fce64259c8c9a2d62b475c9f19fa52c34d092b09c81e4770c882bc6abd26010c5b912e4ab94554f87765219c5216e06c4f6bd98690db3ed860656bd3d
7
+ data.tar.gz: 259ecd2569794568dc10115403426b2deab1bf789fd45809ed0c8f1bcb136b98413757906ee691a65fac5f34413d7adac587784618233519f18a0b45d6fedd20
data/Changelog CHANGED
@@ -1,3 +1,9 @@
1
+ 0.11.0
2
+ New method Values#has_tag? to check if a tag is present.
3
+ Handle invalid values for timestamps and rationals: Timestamps where month or
4
+ day is zero (i.e. 0000:00:00 00:00:00) are converted to nil. Strings of the
5
+ form n/0 are not interpreted as rational value and are not converted.
6
+
1
7
  0.10.0
2
8
  Values#convert is now a public method. So you can simply adapt the value
3
9
  conversion to your needs.
@@ -7,7 +7,7 @@ require_relative 'multi_exiftool/writer'
7
7
 
8
8
  module MultiExiftool
9
9
 
10
- VERSION = '0.10.0'
10
+ VERSION = '0.11.0'
11
11
 
12
12
  @exiftool_command = 'exiftool'
13
13
 
@@ -49,17 +49,27 @@ module MultiExiftool
49
49
  case val
50
50
  when REGEXP_TIMESTAMP
51
51
  year, month, day, hour, minute = $~.captures[0,5].map {|cap| cap.to_i}
52
+ if month == 0 || day == 0
53
+ return nil
54
+ end
52
55
  second = $6.to_f
53
56
  zone = $7
54
57
  zone = '+00:00' if zone == 'Z'
55
58
  Time.new(year, month, day, hour, minute, second, zone)
56
59
  when REGEXP_RATIONAL
60
+ return val if $2.to_i == 0
57
61
  Rational($1, $2)
58
62
  else
59
63
  val
60
64
  end
61
65
  end
62
66
 
67
+ # Checks if a tag is present
68
+ # @param Tag as string or symbol (will be unified)
69
+ def has_tag? tag
70
+ @values.has_key?(Values.unify_tag(tag.to_s))
71
+ end
72
+
63
73
  # Gets the original tag names of this instance
64
74
  def tags
65
75
  @values.keys.map {|tag| Values.tag_map[tag]}
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: multi_exiftool 0.10.0 ruby lib
2
+ # stub: multi_exiftool 0.11.0 ruby lib
3
3
  #
4
4
  # This file is automatically generated by rim.
5
5
  # PLEASE DO NOT EDIT IT DIRECTLY!
@@ -7,12 +7,12 @@
7
7
 
8
8
  Gem::Specification.new do |s|
9
9
  s.name = "multi_exiftool"
10
- s.version = "0.10.0"
10
+ s.version = "0.11.0"
11
11
 
12
12
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
13
13
  s.require_paths = ["lib"]
14
14
  s.authors = ["Jan Friedrich"]
15
- s.date = "2018-08-21"
15
+ s.date = "2018-08-22"
16
16
  s.description = "This library a is wrapper for the ExifTool command-line application (http://www.sno.phy.queensu.ca/~phil/exiftool) written by Phil Harvey. It is designed for dealing with multiple files at once by creating commands to call exiftool with various arguments, call it and parsing the results."
17
17
  s.email = "janfri26@gmail.com"
18
18
  s.files = ["./.aspell.pws", "Changelog", "Gemfile", "LICENSE", "README.md", "Rakefile", "lib/multi_exiftool", "lib/multi_exiftool.rb", "lib/multi_exiftool/executable.rb", "lib/multi_exiftool/reader.rb", "lib/multi_exiftool/values.rb", "lib/multi_exiftool/writer.rb", "multi_exiftool.gemspec", "regtest/read_all_tags.rb", "regtest/read_all_tags.yml", "regtest/test.jpg", "test/data", "test/data/a.jpg", "test/data/b.jpg", "test/data/c.jpg", "test/helper.rb", "test/test_executable.rb", "test/test_exiftool_stuff.rb", "test/test_functional_api.rb", "test/test_reader.rb", "test/test_values.rb", "test/test_values_using_groups.rb", "test/test_writer.rb", "test/test_writer_groups.rb"]
@@ -21,7 +21,7 @@ Gem::Specification.new do |s|
21
21
  s.post_install_message = "\n+-----------------------------------------------------------------------+\n| Please ensure you have installed exiftool version 7.65 or higher and |\n| it's found in your PATH (Try \"exiftool -ver\" on your commandline). |\n| For more details see |\n| http://www.sno.phy.queensu.ca/~phil/exiftool/install.html |\n+-----------------------------------------------------------------------+\n "
22
22
  s.required_ruby_version = Gem::Requirement.new(">= 1.9.1")
23
23
  s.requirements = ["exiftool, version 7.65 or higher"]
24
- s.rubygems_version = "3.0.0.beta1"
24
+ s.rubygems_version = "2.7.6"
25
25
  s.summary = "This library is a wrapper for the ExifTool command-line application (http://www.sno.phy.queensu.ca/~phil/exiftool)."
26
26
 
27
27
  if s.respond_to? :specification_version then
@@ -113,6 +113,45 @@ class TestValues < Test::Unit::TestCase
113
113
 
114
114
  end
115
115
 
116
+ context 'invalid values' do
117
+
118
+ test 'timestamp with only zeros' do
119
+ values = MultiExiftool::Values.new('TimeWithOnlyZeros' => '0000:00:00 00:00:00')
120
+ assert_nil values['TimeWithOnlyZeros']
121
+ end
122
+
123
+ test 'rational with denominator zero' do
124
+ values = MultiExiftool::Values.new('DenominatorZero' => '1/0')
125
+ assert_equal '1/0', values['DenominatorZero']
126
+ end
127
+
128
+ end
129
+
130
+ end
131
+
132
+ context 'has_tag?' do
133
+ setup do
134
+ @hash = {'FNumber' => 8, 'Author' => 'janfri', 'E-MailAddress' => 'janfri26@gmail.com', 'DateTimeOriginal' => '2018:08:22 11:50:00'}
135
+ @values = MultiExiftool::Values.new(@hash)
136
+ end
137
+
138
+ test 'different formats as string' do
139
+ @hash.keys.each do |k|
140
+ assert_true @values.has_tag? k
141
+ end
142
+ end
143
+
144
+ test 'different formats as symbol' do
145
+ @hash.keys.each do |k|
146
+ assert_true @values.has_tag? k.to_sym
147
+ end
148
+ end
149
+
150
+ test 'non existent key' do
151
+ ['iso', 'ISO', :iso, :ISO].each do |t|
152
+ assert_false @values.has_tag? t
153
+ end
154
+ end
116
155
  end
117
156
 
118
157
  context 'tags and to_h' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: multi_exiftool
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Friedrich
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-21 00:00:00.000000000 Z
11
+ date: 2018-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -142,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
142
  requirements:
143
143
  - exiftool, version 7.65 or higher
144
144
  rubyforge_project:
145
- rubygems_version: 3.0.0.beta1
145
+ rubygems_version: 2.7.6
146
146
  signing_key:
147
147
  specification_version: 4
148
148
  summary: This library is a wrapper for the ExifTool command-line application (http://www.sno.phy.queensu.ca/~phil/exiftool).