mini_exiftool 1.3.1 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/Changelog CHANGED
@@ -1,3 +1,7 @@
1
+ v1.4.0
2
+ - Allow symbols for tag access with [].
3
+ - Refactoring tests.
4
+
1
5
  v1.3.1
2
6
  - Remove TestEscapeFilename test and releating test photo
3
7
  because the latter produces errors on windows systems.
@@ -35,7 +39,7 @@ v1.0.1
35
39
 
36
40
  v1.0.0
37
41
  - Be aware changing in the interface:
38
- - List tags (e.g. Keywords, SupplementalCategories) are now handled as
42
+ - List tags (e.g. Keywords, SupplementalCategories) are now handled as
39
43
  arrays.
40
44
  - Tag SubjectLocation is not longer an array value but a string value!
41
45
 
@@ -64,7 +68,7 @@ v0.5.1
64
68
  v0.5.0
65
69
  - New option :timestamps to create DateTime objects instead of Time objects
66
70
  for timestamps (Fixing bug #16328)
67
- - Invalid values of timestamps (i.e. 0000:00:00 00:00:00) are now mapped
71
+ - Invalid values of timestamps (i.e. 0000:00:00 00:00:00) are now mapped
68
72
  to false
69
73
 
70
74
  v0.4.1
@@ -74,7 +78,7 @@ v0.4.0
74
78
  - MiniExiftool::Error inherits now from StandardError
75
79
  - Alternative installation via setup.rb
76
80
  - Bugfix
77
- Saving of non-readed tags doesn't work with tags with hyphen
81
+ Saving of non-read tags doesn't work with tags with hyphen
78
82
  Thanks to Robin Romahn for reporting the bug
79
83
  - New methods: MiniExiftool.all_tags and MiniExiftool.original_tag
80
84
  - Interna: Original tag names (all and writable) are now saved via pstore in
data/TODO CHANGED
@@ -1,4 +1,2 @@
1
1
  * Tests for managing tags with pstore
2
- * Update Tutorial
3
- * Describing the options :composite and :timestamps
4
2
  * Looking for a solution to dump and restore DateTime instances with YAML
data/Tutorial CHANGED
@@ -28,6 +28,10 @@ following expressions are equivalent:
28
28
  photo['datetimeoriginal']
29
29
  photo['date_time_original']
30
30
 
31
+ It is also possible to use symbols:
32
+ photo[:DateTimeOriginal]
33
+ photo[:datetimeoriginal]
34
+ photo[:date_time_original]
31
35
 
32
36
  === Nicer Access Via Dynamic Methods
33
37
 
@@ -44,7 +48,7 @@ or also
44
48
  Following types of values are at the moment supported:
45
49
  * Array (e. g. Keywords => ['tree', 'gras'])
46
50
  * Fixnum (e. g. ISO => 400)
47
- * Float (e. g. FNumber => 9.5)
51
+ * Float (e. g. FNumber => 9.5)
48
52
  * String (e. g. Model => DYNAX 7D)
49
53
  * Time (e. g. DateTimeOriginal => 2005:09:13 20:08:50)
50
54
 
@@ -83,7 +87,7 @@ maybe better.
83
87
 
84
88
  The Time class of Ruby cannot handle timestamps before 1st January 1970
85
89
  on some platforms. If there are timestamps in files before this date it
86
- will result in an error. In this case we can set the option
90
+ will result in an error. In this case we can set the option
87
91
  <code>:timestamps</code> to +DateTime+ to use DateTime objects instead
88
92
  of Time objects.
89
93
 
data/lib/mini_exiftool.rb CHANGED
@@ -9,7 +9,7 @@
9
9
  #
10
10
  # Author: Jan Friedrich
11
11
  # Copyright (c) 2007-2011 by Jan Friedrich
12
- # Licensed under the GNU LESSER GENERAL PUBLIC LICENSE,
12
+ # Licensed under the GNU LESSER GENERAL PUBLIC LICENSE,
13
13
  # Version 2.1, February 1999
14
14
  #
15
15
 
@@ -32,13 +32,13 @@ class MiniExiftool
32
32
  attr_reader :filename
33
33
  attr_accessor :numerical, :composite, :convert_encoding, :errors, :timestamps
34
34
 
35
- VERSION = '1.3.1'
35
+ VERSION = '1.4.0'
36
36
 
37
37
  # +opts+ support at the moment
38
38
  # * <code>:numerical</code> for numerical values, default is +false+
39
39
  # * <code>:composite</code> for including composite tags while loading,
40
40
  # default is +true+
41
- # * <code>:convert_encoding</code> convert encoding (See -L-option of
41
+ # * <code>:convert_encoding</code> convert encoding (See -L-option of
42
42
  # the exiftool command-line application, default is +false+
43
43
  # * <code>:timestamps</code> generating DateTime objects instead of
44
44
  # Time objects if set to <code>DateTime</code>, default is +Time+
@@ -59,7 +59,7 @@ class MiniExiftool
59
59
  load filename unless filename.nil?
60
60
  end
61
61
 
62
- def initialize_from_hash hash # :nodoc:
62
+ def initialize_from_hash hash # :nodoc:
63
63
  hash.each_pair do |tag,value|
64
64
  set_value tag, value
65
65
  end
@@ -92,7 +92,7 @@ class MiniExiftool
92
92
  self
93
93
  end
94
94
 
95
- # Reload the tags of an already readed file.
95
+ # Reload the tags of an already read file.
96
96
  def reload
97
97
  load @filename
98
98
  end
@@ -129,7 +129,7 @@ class MiniExiftool
129
129
  res
130
130
  end
131
131
 
132
- # Returns an array of the tags (original tag names) of the readed file.
132
+ # Returns an array of the tags (original tag names) of the read file.
133
133
  def tags
134
134
  @values.keys.map { |key| @tag_names[key] }
135
135
  end
@@ -185,9 +185,9 @@ class MiniExiftool
185
185
  result[@tag_names[k]] = v
186
186
  end
187
187
  result
188
- end
188
+ end
189
189
 
190
- # Returns a YAML representation of the original loaded values of the
190
+ # Returns a YAML representation of the original loaded values of the
191
191
  # MiniExiftool instance.
192
192
  def to_yaml
193
193
  to_hash.to_yaml
@@ -255,7 +255,7 @@ class MiniExiftool
255
255
  end
256
256
 
257
257
  def self.unify tag
258
- tag.gsub(/[-_]/,'').downcase
258
+ tag.to_s.gsub(/[-_]/,'').downcase
259
259
  end
260
260
 
261
261
  # Exception class
@@ -420,7 +420,7 @@ class MiniExiftool
420
420
  end
421
421
 
422
422
 
423
- # Hash with indifferent access:
423
+ # Hash with indifferent access:
424
424
  # DateTimeOriginal == datetimeoriginal == date_time_original
425
425
  class TagHash < Hash # :nodoc:
426
426
  def[] k
@@ -437,7 +437,7 @@ class MiniExiftool
437
437
  MiniExiftool.unify tag
438
438
  end
439
439
  end
440
-
440
+
441
441
  end
442
442
 
443
443
  # Add to_a to Numerical if it's not yet defined
@@ -1,30 +1,24 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
3
  Gem::Specification.new do |s|
4
- s.name = %q{mini_exiftool}
5
- s.version = "1.3.1"
4
+ s.name = "mini_exiftool"
5
+ s.version = "1.4.0"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
- s.authors = [%q{Jan Friedrich}]
9
- s.date = %q{2011-07-29}
10
- s.description = %q{This library is wrapper for the Exiftool command-line application (http://www.sno.phy.queensu.ca/~phil/exiftool).}
11
- s.email = %q{janfri26@gmail.com}
12
- s.extra_rdoc_files = [%q{README}, %q{Tutorial}, %q{lib/mini_exiftool.rb}]
13
- s.files = [%q{COPYING}, %q{Changelog}, %q{Manifest}, %q{README}, %q{Rakefile}, %q{TODO}, %q{Tutorial}, %q{examples/external_photo.rb}, %q{examples/print_portraits.rb}, %q{examples/shift_time.rb}, %q{lib/mini_exiftool.rb}, %q{setup.rb}, %q{test/data/Canon.jpg}, %q{test/data/INFORMATION}, %q{test/data/test.jpg}, %q{test/data/test_special_dates.jpg}, %q{test/helpers_for_test.rb}, %q{test/test_class_methods.rb}, %q{test/test_composite.rb}, %q{test/test_dumping.rb}, %q{test/test_read.rb}, %q{test/test_read_numerical.rb}, %q{test/test_save.rb}, %q{test/test_special.rb}, %q{test/test_special_dates.rb}, %q{test/test_write.rb}, %q{mini_exiftool.gemspec}]
14
- s.homepage = %q{http://gitorious.org/mini_exiftool}
15
- s.post_install_message = %q{
16
- +-----------------------------------------------------------------------+
17
- | Please ensure you have installed exiftool and it's found in your PATH |
18
- | (Try "exiftool -ver" on your commandline). For more details see |
19
- | http://www.sno.phy.queensu.ca/~phil/exiftool/install.html |
20
- +-----------------------------------------------------------------------+
21
- }
22
- s.rdoc_options = [%q{--line-numbers}, %q{--inline-source}, %q{--title}, %q{Mini_exiftool}, %q{--main}, %q{README}]
23
- s.require_paths = [%q{lib}]
24
- s.rubyforge_project = %q{mini_exiftool}
25
- s.rubygems_version = %q{1.8.5}
26
- s.summary = %q{This library is wrapper for the Exiftool command-line application (http://www.sno.phy.queensu.ca/~phil/exiftool).}
27
- s.test_files = [%q{test/helpers_for_test.rb}, %q{test/test_class_methods.rb}, %q{test/test_composite.rb}, %q{test/test_dumping.rb}, %q{test/test_read.rb}, %q{test/test_read_numerical.rb}, %q{test/test_save.rb}, %q{test/test_special.rb}, %q{test/test_special_dates.rb}, %q{test/test_write.rb}]
8
+ s.authors = ["Jan Friedrich"]
9
+ s.date = "2012-04-11"
10
+ s.description = "This library is wrapper for the Exiftool command-line application (http://www.sno.phy.queensu.ca/~phil/exiftool)."
11
+ s.email = "janfri26@gmail.com"
12
+ s.extra_rdoc_files = ["README", "Tutorial", "lib/mini_exiftool.rb"]
13
+ s.files = ["COPYING", "Changelog", "Manifest", "README", "Rakefile", "TODO", "Tutorial", "examples/external_photo.rb", "examples/print_portraits.rb", "examples/shift_time.rb", "lib/mini_exiftool.rb", "setup.rb", "test/data/Canon.jpg", "test/data/INFORMATION", "test/data/test.jpg", "test/data/test_special_dates.jpg", "test/helpers_for_test.rb", "test/test_class_methods.rb", "test/test_composite.rb", "test/test_dumping.rb", "test/test_read.rb", "test/test_read_numerical.rb", "test/test_save.rb", "test/test_special.rb", "test/test_special_dates.rb", "test/test_write.rb", "mini_exiftool.gemspec"]
14
+ s.homepage = "http://gitorious.org/mini_exiftool"
15
+ s.post_install_message = "\n+-----------------------------------------------------------------------+\n| Please ensure you have installed exiftool and it's found in your PATH |\n| (Try \"exiftool -ver\" on your commandline). For more details see |\n| http://www.sno.phy.queensu.ca/~phil/exiftool/install.html |\n+-----------------------------------------------------------------------+\n "
16
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Mini_exiftool", "--main", "README"]
17
+ s.require_paths = ["lib"]
18
+ s.rubyforge_project = "mini_exiftool"
19
+ s.rubygems_version = "1.8.21"
20
+ s.summary = "This library is wrapper for the Exiftool command-line application (http://www.sno.phy.queensu.ca/~phil/exiftool)."
21
+ s.test_files = ["test/helpers_for_test.rb", "test/test_class_methods.rb", "test/test_composite.rb", "test/test_dumping.rb", "test/test_read.rb", "test/test_read_numerical.rb", "test/test_save.rb", "test/test_special.rb", "test/test_special_dates.rb", "test/test_write.rb"]
28
22
 
29
23
  if s.respond_to? :specification_version then
30
24
  s.specification_version = 3
@@ -1,6 +1,8 @@
1
1
  # -- encoding: utf-8 --
2
2
  require 'mini_exiftool'
3
3
  require 'test/unit'
4
+ require 'fileutils'
5
+ require 'tempfile'
4
6
  begin
5
7
  require 'turn'
6
8
  rescue LoadError
@@ -12,3 +14,15 @@ rescue LoadError
12
14
  end
13
15
 
14
16
  include Test::Unit
17
+
18
+ module TempfileTest
19
+ def setup
20
+ @temp_file = Tempfile.new('test')
21
+ @temp_filename = @temp_file.path
22
+ @data_dir = File.dirname(__FILE__) + '/data'
23
+ end
24
+
25
+ def teardown
26
+ @temp_file.close
27
+ end
28
+ end
data/test/test_read.rb CHANGED
@@ -12,6 +12,8 @@ class TestRead < TestCase
12
12
  def test_access
13
13
  assert_equal 'DYNAX 7D', @mini_exiftool['Model']
14
14
  assert_equal 'MLT0', @mini_exiftool['maker_note_version']
15
+ assert_equal 'MLT0', @mini_exiftool[:MakerNoteVersion]
16
+ assert_equal 'MLT0', @mini_exiftool[:maker_note_version]
15
17
  assert_equal 'MLT0', @mini_exiftool.maker_note_version
16
18
  assert_equal 400, @mini_exiftool.iso
17
19
  end
@@ -12,6 +12,8 @@ class TestReadNumerical < TestCase
12
12
  def test_access_numerical
13
13
  assert_equal 'DYNAX 7D', @mini_exiftool_num['Model']
14
14
  assert_equal 'MLT0', @mini_exiftool_num['maker_note_version']
15
+ assert_equal 'MLT0', @mini_exiftool_num[:MakerNoteVersion]
16
+ assert_equal 'MLT0', @mini_exiftool_num[:maker_note_version]
15
17
  assert_equal 'MLT0', @mini_exiftool_num.maker_note_version
16
18
  assert_equal 400, @mini_exiftool_num.iso
17
19
  end
data/test/test_save.rb CHANGED
@@ -6,11 +6,11 @@ require 'helpers_for_test'
6
6
 
7
7
  class TestSave < TestCase
8
8
 
9
+ include TempfileTest
10
+
9
11
  def setup
10
- @temp_file = Tempfile.new('test')
11
- @temp_file.close
12
- @temp_filename = @temp_file.path
13
- @org_filename = File.dirname(__FILE__) + '/data/test.jpg'
12
+ super
13
+ @org_filename = @data_dir + '/test.jpg'
14
14
  FileUtils.cp(@org_filename, @temp_filename)
15
15
  @mini_exiftool = MiniExiftool.new @temp_filename
16
16
  @mini_exiftool_num = MiniExiftool.new @temp_filename, :numerical => true
data/test/test_special.rb CHANGED
@@ -1,19 +1,16 @@
1
1
  # -- encoding: utf-8 --
2
- require 'fileutils'
3
- require 'tempfile'
4
2
  require 'helpers_for_test'
5
3
 
6
4
  class TestSpecial < TestCase
7
5
 
6
+ include TempfileTest
7
+
8
8
  CAPTION_ABSTRACT = 'Some text for caption abstract'
9
9
 
10
10
  def setup
11
- data_dir = File.dirname(__FILE__) + '/data'
12
- temp_file = Tempfile.new('test')
13
- temp_file.close
14
- @temp_filename = temp_file.path
15
- org_filename = data_dir + '/Canon.jpg'
16
- FileUtils.cp org_filename, @temp_filename
11
+ super
12
+ @org_filename = @data_dir + '/Canon.jpg'
13
+ FileUtils.cp @org_filename, @temp_filename
17
14
  @canon = MiniExiftool.new @temp_filename
18
15
  end
19
16
 
@@ -1,18 +1,15 @@
1
1
  # -- encoding: utf-8 --
2
2
  require 'date'
3
- require 'fileutils'
4
- require 'tempfile'
5
3
  require 'helpers_for_test'
6
4
 
7
5
  class TestSpecialDates < TestCase
8
6
 
7
+ include TempfileTest
8
+
9
9
  def setup
10
- data_dir = File.dirname(__FILE__) + '/data'
11
- temp_file = Tempfile.new('test')
12
- temp_file.close
13
- @temp_filename = temp_file.path
14
- org_filename = data_dir + '/test_special_dates.jpg'
15
- FileUtils.cp org_filename, @temp_filename
10
+ super
11
+ @org_filename = @data_dir + '/test_special_dates.jpg'
12
+ FileUtils.cp @org_filename, @temp_filename
16
13
  @mini_exiftool = MiniExiftool.new @temp_filename
17
14
  @mini_exiftool_datetime = MiniExiftool.new @temp_filename,
18
15
  :timestamps => DateTime
@@ -21,7 +18,7 @@ class TestSpecialDates < TestCase
21
18
  # Catching bug [#16328] (1st part)
22
19
  # Thanks to unknown
23
20
  def test_datetime
24
- datetime_original = @mini_exiftool.datetime_original
21
+ datetime_original = @mini_exiftool.datetime_original
25
22
  if datetime_original
26
23
  assert_kind_of Time, datetime_original
27
24
  else
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: mini_exiftool
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.3.1
5
+ version: 1.4.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Jan Friedrich
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-07-29 00:00:00 Z
13
+ date: 2012-04-11 00:00:00 Z
14
14
  dependencies: []
15
15
 
16
16
  description: This library is wrapper for the Exiftool command-line application (http://www.sno.phy.queensu.ca/~phil/exiftool).
@@ -84,7 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
84
84
  requirements: []
85
85
 
86
86
  rubyforge_project: mini_exiftool
87
- rubygems_version: 1.8.5
87
+ rubygems_version: 1.8.21
88
88
  signing_key:
89
89
  specification_version: 3
90
90
  summary: This library is wrapper for the Exiftool command-line application (http://www.sno.phy.queensu.ca/~phil/exiftool).