multi_exiftool 0.7.0 → 0.8.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
- SHA1:
3
- metadata.gz: 336f2936dab3e01ed677d0ebd9f6584ec23c3f43
4
- data.tar.gz: f5fe22977414dbfb347fa630502e6f2f3efca0f9
2
+ SHA256:
3
+ metadata.gz: 8b015e9af2e57bc797d737a4dc8d69ad8916eaa5d57a593571674ebcd66bd4bd
4
+ data.tar.gz: 5d1f4bfd5b5b8673e2bcb5721dac40932229f173688c1cb5e3179dd44d66b19c
5
5
  SHA512:
6
- metadata.gz: b0e6c188bb957da09426ce4ca7d76376a6cdbcc2e1419d2acb4450a0dfe22cfacae0f025ef8942384d3bbebe1bc541e8580b21c05a79928f8f8a8bfc84cc15fd
7
- data.tar.gz: 0e5c953e9da646a239ea2537e67d4d0215d4f320ec609071329bfbda5041ca896a6ead151f14e43d2c4f2df269755e234aa1999afebf796ba4e3ec442b24c779
6
+ metadata.gz: d6d71bd49a05fd9776cc509a897766a1e6c1e8bd2d5f8adf697843b0be65a370fc78d49845aa65e309bb26053d03844b798e72c2cbead89a668dc4fa13fc656c
7
+ data.tar.gz: 5c96b7c4d26243e2047a85916d6d075f7add191b48edc07d181a8cf89dc42cedbcb005d5665bc10a24904f0bcd8eb36faca5fb71c86e4670f2daaae0835860de
@@ -1,27 +1,30 @@
1
- personal_ws-1.1 en 26
1
+ personal_ws-1.1 en 29
2
2
  UTC
3
+ NONINFRINGEMENT
4
+ szTheory
3
5
  janfri
4
6
  multi
5
- MultiExiftool
6
- MERCHANTABILITY
7
+ dir
7
8
  api
8
9
  Gemfile
9
10
  sublicense
10
11
  tmpdir
11
- exiftool
12
12
  ExifTool
13
+ exiftool
13
14
  gmail
14
15
  ok
15
16
  timestamps
16
17
  jpg
17
18
  refactoring
18
- NONINFRINGEMENT
19
19
  Gitorious
20
20
  gemspec
21
21
  Friedrich
22
+ MultiExiftool
22
23
  filenames
24
+ PartOfSet
23
25
  README
24
26
  stdin
27
+ MERCHANTABILITY
25
28
  Coenen
26
29
  stderr
27
30
  gittycat
data/Changelog CHANGED
@@ -1,3 +1,13 @@
1
+ 0.8.0
2
+ Add MultiExiftool::VERSION.
3
+ Rename method Values#parse_value -> convert and add parameter tag to allow tag
4
+ based conversions.
5
+ So PartOfSet and Track values are not longer converted to Rational. Fix a
6
+ really big bug in test suite: Would always pass because run_in_temp_dir was
7
+ broken, so the block was never executed. Therefor 46 assertions were not
8
+ executed since version 0.7.0. Many thanks to szTheory for this great catch!
9
+
10
+
1
11
  0.7.0
2
12
  Use Dir.tmpdir instead of test/temp for tests which manipulates images.
3
13
  Update to rim 2.15.
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # MultiExiftool
1
+ # MultiExiftool [![Build Status](https://travis-ci.org/janfri/multi_exiftool.svg?branch=master)](https://travis-ci.org/janfri/multi_exiftool)
2
2
 
3
3
  ## Description
4
4
 
data/Rakefile CHANGED
@@ -1,10 +1,14 @@
1
+ # encoding: utf-8
2
+ # frozen_string_literal: true
3
+
4
+ require_relative 'lib/multi_exiftool'
1
5
  require 'rim/tire'
2
6
  require 'rim/version'
3
7
  require 'rim/regtest'
4
8
 
5
9
  Rim.setup do |p|
6
10
  p.name = 'multi_exiftool'
7
- p.version = '0.7.0'
11
+ p.version = MultiExiftool::VERSION
8
12
  p.authors = 'Jan Friedrich'
9
13
  p.email = 'janfri26@gmail.com'
10
14
  p.summary = 'This library is a wrapper for the ExifTool command-line application (http://www.sno.phy.queensu.ca/~phil/exiftool).'
@@ -1,10 +1,14 @@
1
- # coding: utf-8
1
+ # encoding: utf-8
2
+ # frozen_string_literal: true
3
+
2
4
  require_relative 'multi_exiftool/values'
3
5
  require_relative 'multi_exiftool/reader'
4
6
  require_relative 'multi_exiftool/writer'
5
7
 
6
8
  module MultiExiftool
7
9
 
10
+ VERSION = '0.8.0'
11
+
8
12
  # Reading metadata
9
13
  # Be aware: it returns an array of two elements:
10
14
  # values, errors
@@ -1,4 +1,6 @@
1
- # coding: utf-8
1
+ # encoding: utf-8
2
+ # frozen_string_literal: true
3
+
2
4
  require 'open3'
3
5
 
4
6
  module MultiExiftool
@@ -1,4 +1,6 @@
1
- # coding: utf-8
1
+ # encoding: utf-8
2
+ # frozen_string_literal: true
3
+
2
4
  require_relative 'executable'
3
5
  require 'json'
4
6
 
@@ -1,4 +1,6 @@
1
- # coding: utf-8
1
+ # encoding: utf-8
2
+ # frozen_string_literal: true
3
+
2
4
  require 'date'
3
5
  require 'set'
4
6
 
@@ -25,7 +27,8 @@ module MultiExiftool
25
27
  # (tag will be unified, i.e. FNumber, fnumber or f_number
26
28
  # can be used for FNumber)
27
29
  def [](tag)
28
- parse_value(@values[Values.unify_tag(tag)])
30
+ unified_tag = Values.unify_tag(tag)
31
+ convert(unified_tag, @values[unified_tag])
29
32
  end
30
33
 
31
34
  # Gets the original tag names of this instance
@@ -37,9 +40,9 @@ module MultiExiftool
37
40
  # with original tag names es keys and converted
38
41
  # values as values
39
42
  def to_h
40
- @values.inject(Hash.new) do |h,a|
41
- k, v = a
42
- h[Values.tag_map[k]] = parse_value(v)
43
+ @values.inject(Hash.new) do |h, a|
44
+ tag, val = a
45
+ h[Values.tag_map[tag]] = convert(Values.unify_tag(tag), val)
43
46
  h
44
47
  end
45
48
  end
@@ -70,8 +73,12 @@ module MultiExiftool
70
73
  res
71
74
  end
72
75
 
73
- def parse_value val
76
+ def convert tag, val
74
77
  return val unless val.kind_of?(String)
78
+ case tag
79
+ when 'partofset', 'track'
80
+ return val
81
+ end
75
82
  case val
76
83
  when /^(\d{4}):(\d\d):(\d\d) (\d\d):(\d\d)(?::(\d\d)(?:\.\d+)?)?((?:[-+]\d\d:\d\d)|(?:Z))?(?: *DST)?$/
77
84
  arr = $~.captures[0,6].map {|cap| cap.to_i}
@@ -1,4 +1,6 @@
1
- # coding: utf-8
1
+ # encoding: utf-8
2
+ # frozen_string_literal: true
3
+
2
4
  require_relative 'executable'
3
5
 
4
6
  module MultiExiftool
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: multi_exiftool 0.7.0 ruby lib
2
+ # stub: multi_exiftool 0.8.0 ruby lib
3
3
  #
4
4
  # This file is automatically generated by rim.
5
5
  # PLEASE DO NOT EDIT IT DIRECTLY!
@@ -7,21 +7,21 @@
7
7
 
8
8
  Gem::Specification.new do |s|
9
9
  s.name = "multi_exiftool"
10
- s.version = "0.7.0"
10
+ s.version = "0.8.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 = "2017-09-19"
15
+ s.date = "2018-04-04"
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
- 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", "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"]
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/temp", "test/temp/a.jpg", "test/temp/a.jpg_original", "test/temp/b.jpg", "test/temp/b.jpg_original", "test/temp/c.jpg", "test/temp/c.jpg_original", "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"]
19
19
  s.homepage = "https://github.com/janfri/multi_exiftool"
20
20
  s.licenses = ["MIT"]
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 = "2.6.13"
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
@@ -29,22 +29,22 @@ Gem::Specification.new do |s|
29
29
 
30
30
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
31
31
  s.add_development_dependency(%q<rake>, [">= 0"])
32
- s.add_development_dependency(%q<rim>, ["~> 2.15"])
32
+ s.add_development_dependency(%q<rim>, ["~> 2.17"])
33
33
  s.add_development_dependency(%q<contest>, ["~> 0.1"])
34
34
  s.add_development_dependency(%q<test-unit>, [">= 0"])
35
- s.add_development_dependency(%q<regtest>, ["~> 1.0"])
35
+ s.add_development_dependency(%q<regtest>, ["~> 2"])
36
36
  else
37
37
  s.add_dependency(%q<rake>, [">= 0"])
38
- s.add_dependency(%q<rim>, ["~> 2.15"])
38
+ s.add_dependency(%q<rim>, ["~> 2.17"])
39
39
  s.add_dependency(%q<contest>, ["~> 0.1"])
40
40
  s.add_dependency(%q<test-unit>, [">= 0"])
41
- s.add_dependency(%q<regtest>, ["~> 1.0"])
41
+ s.add_dependency(%q<regtest>, ["~> 2"])
42
42
  end
43
43
  else
44
44
  s.add_dependency(%q<rake>, [">= 0"])
45
- s.add_dependency(%q<rim>, ["~> 2.15"])
45
+ s.add_dependency(%q<rim>, ["~> 2.17"])
46
46
  s.add_dependency(%q<contest>, ["~> 0.1"])
47
47
  s.add_dependency(%q<test-unit>, [">= 0"])
48
- s.add_dependency(%q<regtest>, ["~> 1.0"])
48
+ s.add_dependency(%q<regtest>, ["~> 2"])
49
49
  end
50
50
  end
@@ -1,8 +1,6 @@
1
1
  require 'regtest'
2
2
  require 'multi_exiftool'
3
3
 
4
- include Regtest
5
-
6
- sample 'read all tags' do
4
+ Regtest.sample 'read all tags' do
7
5
  MultiExiftool.read('regtest/test.jpg', tags: %w(-filemodifydate -fileaccessdate -fileinodechangedate -filepermissions))
8
6
  end
Binary file
@@ -1,4 +1,6 @@
1
- # coding: utf-8
1
+ # encoding: utf-8
2
+ # frozen_string_literal: true
3
+
2
4
  require_relative '../lib/multi_exiftool'
3
5
  require 'contest'
4
6
  require 'fileutils'
@@ -7,11 +9,11 @@ require 'tmpdir'
7
9
 
8
10
  module TestHelper
9
11
 
10
- DATA_DIR = File.join(File.dirname(__FILE__), 'data')
12
+ DATA_FILES = Dir.glob(File.join(File.dirname(__FILE__), 'data/*'))
11
13
 
12
14
  def run_in_temp_dir &block
13
- Dir.tmpdir do |tmpdir|
14
- FileUtils.cp_r DATA_DIR, tmpdir
15
+ Dir.mktmpdir do |tmpdir|
16
+ FileUtils.cp_r DATA_FILES, tmpdir
15
17
  Dir.chdir tmpdir do
16
18
  block.call
17
19
  end
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -1,4 +1,6 @@
1
- # coding: utf-8
1
+ # encoding: utf-8
2
+ # frozen_string_literal: true
3
+
2
4
  require_relative 'helper'
3
5
 
4
6
  class TestExecutable < Test::Unit::TestCase
@@ -1,4 +1,6 @@
1
- # coding: utf-8
1
+ # encoding: utf-8
2
+ # frozen_string_literal: true
3
+
2
4
  require_relative 'helper'
3
5
 
4
6
  class TestExiftoolStuff < Test::Unit::TestCase
@@ -20,7 +22,7 @@ class TestExiftoolStuff < Test::Unit::TestCase
20
22
  v = MultiExiftool.exiftool_version
21
23
  assert_not_nil v
22
24
  end
23
- assert t_now * 100 < t_org
25
+ assert t_now * 10 < t_org, 'access to cached version of attribute exiftool_version should be 10 times faster'
24
26
  end
25
27
 
26
28
  protected
@@ -1,4 +1,6 @@
1
- # coding: utf-8
1
+ # encoding: utf-8
2
+ # frozen_string_literal: true
3
+
2
4
  require_relative 'helper'
3
5
 
4
6
  class TestFunctionalApi < Test::Unit::TestCase
@@ -1,4 +1,6 @@
1
- # coding: utf-8
1
+ # encoding: utf-8
2
+ # frozen_string_literal: true
3
+
2
4
  require_relative 'helper'
3
5
 
4
6
  class TestReader < Test::Unit::TestCase
@@ -1,4 +1,6 @@
1
- # coding: utf-8
1
+ # encoding: utf-8
2
+ # frozen_string_literal: true
3
+
2
4
  require_relative 'helper'
3
5
  require 'date'
4
6
 
@@ -91,7 +93,9 @@ class TestValues < Test::Unit::TestCase
91
93
 
92
94
  setup do
93
95
  hash = {
94
- 'ShutterSpeed' => '1/200'
96
+ 'ShutterSpeed' => '1/200',
97
+ 'PartOfSet' => '1/2',
98
+ 'Track' => '1/5'
95
99
  }
96
100
  @values = MultiExiftool::Values.new(hash)
97
101
  end
@@ -100,6 +104,11 @@ class TestValues < Test::Unit::TestCase
100
104
  assert_equal Rational(1, 200), @values['ShutterSpeed']
101
105
  end
102
106
 
107
+ test 'no rational conversion' do
108
+ assert_equal '1/2', @values['PartOfSet']
109
+ assert_equal '1/5', @values['Track']
110
+ end
111
+
103
112
  end
104
113
 
105
114
  end
@@ -1,4 +1,6 @@
1
- # coding: utf-8
1
+ # encoding: utf-8
2
+ # frozen_string_literal: true
3
+
2
4
  require_relative 'helper'
3
5
 
4
6
  class TestValuesUsingGroups < Test::Unit::TestCase
@@ -1,4 +1,6 @@
1
- # coding: utf-8
1
+ # encoding: utf-8
2
+ # frozen_string_literal: true
3
+
2
4
  require_relative 'helper'
3
5
 
4
6
  class TestWriter < Test::Unit::TestCase
@@ -1,4 +1,6 @@
1
- # coding: utf-8
1
+ # encoding: utf-8
2
+ # frozen_string_literal: true
3
+
2
4
  require_relative 'helper'
3
5
  require 'yaml'
4
6
 
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.7.0
4
+ version: 0.8.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: 2017-09-19 00:00:00.000000000 Z
11
+ date: 2018-04-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '2.15'
33
+ version: '2.17'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '2.15'
40
+ version: '2.17'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: contest
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '1.0'
75
+ version: '2'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '1.0'
82
+ version: '2'
83
83
  description: This library a is wrapper for the ExifTool command-line application (http://www.sno.phy.queensu.ca/~phil/exiftool)
84
84
  written by Phil Harvey. It is designed for dealing with multiple files at once by
85
85
  creating commands to call exiftool with various arguments, call it and parsing the
@@ -103,10 +103,17 @@ files:
103
103
  - multi_exiftool.gemspec
104
104
  - regtest/read_all_tags.rb
105
105
  - regtest/read_all_tags.yml
106
+ - regtest/test.jpg
106
107
  - test/data/a.jpg
107
108
  - test/data/b.jpg
108
109
  - test/data/c.jpg
109
110
  - test/helper.rb
111
+ - test/temp/a.jpg
112
+ - test/temp/a.jpg_original
113
+ - test/temp/b.jpg
114
+ - test/temp/b.jpg_original
115
+ - test/temp/c.jpg
116
+ - test/temp/c.jpg_original
110
117
  - test/test_executable.rb
111
118
  - test/test_exiftool_stuff.rb
112
119
  - test/test_functional_api.rb
@@ -141,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
141
148
  requirements:
142
149
  - exiftool, version 7.65 or higher
143
150
  rubyforge_project:
144
- rubygems_version: 2.6.13
151
+ rubygems_version: 2.7.6
145
152
  signing_key:
146
153
  specification_version: 4
147
154
  summary: This library is a wrapper for the ExifTool command-line application (http://www.sno.phy.queensu.ca/~phil/exiftool).