mini_exiftool 1.5.1 → 1.6.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.
@@ -70,4 +70,16 @@ class TestSave < TestCase
70
70
  assert_equal special_string_latin1, @mini_exiftool.title
71
71
  end
72
72
 
73
+ def test_save_bang
74
+ @mini_exiftool.orientation = 'some value'
75
+ exception = false
76
+ begin
77
+ @mini_exiftool.save!
78
+ rescue MiniExiftool::Error => e
79
+ assert_match /Orientation/, e.message
80
+ exception = true
81
+ end
82
+ assert exception, "No exception when save! with error."
83
+ end
84
+
73
85
  end
metadata CHANGED
@@ -1,104 +1,87 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: mini_exiftool
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.6.0
4
5
  prerelease:
5
- version: 1.5.1
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Jan Friedrich
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2012-05-31 00:00:00 Z
14
- dependencies: []
15
-
16
- description: This library is wrapper for the Exiftool command-line application (http://www.sno.phy.queensu.ca/~phil/exiftool).
12
+ date: 2012-07-09 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rim
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 1.6.1
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 1.6.1
30
+ description: ''
17
31
  email: janfri26@gmail.com
18
32
  executables: []
19
-
20
33
  extensions: []
21
-
22
- extra_rdoc_files:
34
+ extra_rdoc_files: []
35
+ files:
23
36
  - README.rdoc
24
- - Tutorial.rdoc
25
- - lib/mini_exiftool.rb
26
- files:
27
- - COPYING
28
37
  - Changelog
29
- - Manifest
30
- - README.rdoc
38
+ - COPYING
31
39
  - Rakefile
32
- - TODO
33
- - Tutorial.rdoc
34
- - .yardopts
35
- - examples/external_photo.rb
36
- - examples/print_portraits.rb
37
- - examples/shift_time.rb
38
40
  - lib/mini_exiftool.rb
39
- - setup.rb
41
+ - test/data/Bad_PreviewIFD.jpg
40
42
  - test/data/Canon.jpg
41
43
  - test/data/INFORMATION
42
44
  - test/data/test.jpg
45
+ - test/data/test.jpg.json
43
46
  - test/data/test_special_dates.jpg
44
47
  - test/helpers_for_test.rb
48
+ - test/test_bad_preview_ifd.rb
45
49
  - test/test_class_methods.rb
46
50
  - test/test_composite.rb
47
51
  - test/test_dumping.rb
52
+ - test/test_from_hash.rb
48
53
  - test/test_read.rb
49
54
  - test/test_read_numerical.rb
50
55
  - test/test_save.rb
51
56
  - test/test_special.rb
52
57
  - test/test_special_dates.rb
53
58
  - test/test_write.rb
54
- - mini_exiftool.gemspec
55
- - test/test_bad_preview_ifd.rb
56
59
  homepage: http://gitorious.org/mini_exiftool
57
60
  licenses: []
58
-
59
- post_install_message: "\n\
60
- +-----------------------------------------------------------------------+\n\
61
- | Please ensure you have installed exiftool and it's found in your PATH |\n\
62
- | (Try \"exiftool -ver\" on your commandline). For more details see |\n\
63
- | http://www.sno.phy.queensu.ca/~phil/exiftool/install.html |\n\
64
- +-----------------------------------------------------------------------+\n "
65
- rdoc_options:
66
- - --line-numbers
67
- - --inline-source
68
- - --title
69
- - Mini_exiftool
70
- - --main
71
- - README.rdoc
72
- require_paths:
61
+ post_install_message: ! "\n+-----------------------------------------------------------------------+\n|
62
+ Please ensure you have installed exiftool and it's found in your PATH |\n| (Try
63
+ \"exiftool -ver\" on your commandline). For more details see |\n| http://www.sno.phy.queensu.ca/~phil/exiftool/install.html
64
+ \ |\n+-----------------------------------------------------------------------+\n
65
+ \ "
66
+ rdoc_options: []
67
+ require_paths:
73
68
  - lib
74
- required_ruby_version: !ruby/object:Gem::Requirement
69
+ required_ruby_version: !ruby/object:Gem::Requirement
75
70
  none: false
76
- requirements:
77
- - - ">="
78
- - !ruby/object:Gem::Version
79
- version: "0"
80
- required_rubygems_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ! '>='
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ required_rubygems_version: !ruby/object:Gem::Requirement
81
76
  none: false
82
- requirements:
83
- - - ">="
84
- - !ruby/object:Gem::Version
85
- version: "1.2"
77
+ requirements:
78
+ - - ! '>='
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
86
81
  requirements: []
87
-
88
- rubyforge_project: mini_exiftool
89
- rubygems_version: 1.8.24
82
+ rubyforge_project:
83
+ rubygems_version: 1.8.23
90
84
  signing_key:
91
85
  specification_version: 3
92
86
  summary: This library is wrapper for the Exiftool command-line application (http://www.sno.phy.queensu.ca/~phil/exiftool).
93
- test_files:
94
- - test/helpers_for_test.rb
95
- - test/test_bad_preview_ifd.rb
96
- - test/test_class_methods.rb
97
- - test/test_composite.rb
98
- - test/test_dumping.rb
99
- - test/test_read.rb
100
- - test/test_read_numerical.rb
101
- - test/test_save.rb
102
- - test/test_special.rb
103
- - test/test_special_dates.rb
104
- - test/test_write.rb
87
+ test_files: []
data/.yardopts DELETED
@@ -1 +0,0 @@
1
- --files Tutorial.rdoc,examples/*.rb
data/Manifest DELETED
@@ -1,27 +0,0 @@
1
- COPYING
2
- Changelog
3
- Manifest
4
- README.rdoc
5
- Rakefile
6
- TODO
7
- Tutorial.rdoc
8
- .yardopts
9
- examples/external_photo.rb
10
- examples/print_portraits.rb
11
- examples/shift_time.rb
12
- lib/mini_exiftool.rb
13
- setup.rb
14
- test/data/Canon.jpg
15
- test/data/INFORMATION
16
- test/data/test.jpg
17
- test/data/test_special_dates.jpg
18
- test/helpers_for_test.rb
19
- test/test_class_methods.rb
20
- test/test_composite.rb
21
- test/test_dumping.rb
22
- test/test_read.rb
23
- test/test_read_numerical.rb
24
- test/test_save.rb
25
- test/test_special.rb
26
- test/test_special_dates.rb
27
- test/test_write.rb
data/TODO DELETED
@@ -1,2 +0,0 @@
1
- * Tests for managing tags with pstore
2
- * Looking for a solution to dump and restore DateTime instances with YAML
@@ -1,139 +0,0 @@
1
- = Mini Tutorial
2
-
3
-
4
- == Installation
5
-
6
- * Installing the Exiftool command-line application from Phil Harvey
7
- (see http://www.sno.phy.queensu.ca/~phil/exiftool/install.html)
8
- * Installing the Ruby library (<code>gem install mini_exiftool</code>)
9
-
10
-
11
- == Lesson 1: Reading Meta Data
12
-
13
- === A Simple Example
14
-
15
- require 'rubygems'
16
- require 'mini_exiftool'
17
-
18
- photo = MiniExiftool.new 'photo.jpg'
19
- puts photo['DateTimeOriginal']
20
-
21
-
22
- === Smart Tag Names
23
- In the example above we use <code>photo['DateTimeOriginal']</code> to
24
- get the value for the time the photo was taken. But tag names are not
25
- case sensitive and additional underlines are also irrelevant. So
26
- following expressions are equivalent:
27
- photo['DateTimeOriginal']
28
- photo['datetimeoriginal']
29
- photo['date_time_original']
30
-
31
- It is also possible to use symbols:
32
- photo[:DateTimeOriginal]
33
- photo[:datetimeoriginal]
34
- photo[:date_time_original]
35
-
36
- === Nicer Access Via Dynamic Methods
37
-
38
- Using the []-method is the safest way to access to values of tags
39
- (e. g. Self-timer you can only access this way) but the smarter way is
40
- using dynamic method access. You can write:
41
- photo.datetimeoriginal
42
- or also
43
- photo.date_time_original
44
-
45
-
46
- === Value Types
47
-
48
- Following types of values are at the moment supported:
49
- * Array (e. g. Keywords => ['tree', 'gras'])
50
- * Fixnum (e. g. ISO => 400)
51
- * Float (e. g. FNumber => 9.5)
52
- * String (e. g. Model => DYNAX 7D)
53
- * Time (e. g. DateTimeOriginal => 2005:09:13 20:08:50)
54
-
55
- Be aware, if there is only one value in a tag which can hold multiple
56
- values the result is'nt an array! But you can get one with the Array
57
- method:
58
- # only _one_ keyword
59
- p1 = MiniExiftool.new 'p1.jpg'
60
- p1.keywords # => 'red'
61
- # _more than one_ keywords
62
- p3 = MiniExiftool.new 'p3.jpg'
63
- p3.keywords # => ['red', 'yellow', 'green']
64
-
65
- # if we want to get an array in both cases and don't know
66
- # if there is one ore more values set let's take Array()
67
- Array(p1.keywords) # => ['red']
68
- Array(p3.keywords) # => ['red', 'yellow', 'green']
69
-
70
- The Exiftool command-line application has an option (-n) to get values
71
- as numbers if possible, in MiniExiftool you can do this with setting
72
- the <code>:numerical</code> option to +true+ while generating a new
73
- instance with new or using the <code>numerical=</code>-method
74
- combining with calling <code>reload</code>.
75
-
76
- Let's look at an example:
77
- # standard: numerical is false
78
- photo = MiniExiftool.new 'photo.jpg'
79
- photo.exposure_time # => '1/60' (String)
80
- # now with numerical is true
81
- photo.numerical = true
82
- photo.reload
83
- photo.exposure_time # => 0.01666667 (Float)
84
- This behaviour can be useful if you want to do calculations on the
85
- value, if you only want to show the value the standard behaviour is
86
- maybe better.
87
-
88
- The Time class of Ruby cannot handle timestamps before 1st January 1970
89
- on some platforms. If there are timestamps in files before this date it
90
- will result in an error. In this case we can set the option
91
- <code>:timestamps</code> to +DateTime+ to use DateTime objects instead
92
- of Time objects.
93
-
94
- There is another option <code>:composite</code>. If this is set to
95
- +false+ the composite tags are not calculated by the exiftool
96
- command-line application (option -e).
97
-
98
- === Further Example
99
-
100
- For understanding reading access to meta data also have a look at the
101
- example file <code>print_portraits.rb</code> in the +examples+
102
- directory.
103
-
104
- == Lesson 2: Writing Meta Data
105
-
106
-
107
- === Also A Very Simple Example
108
-
109
- require 'rubygems'
110
- require 'mini_exiftool'
111
-
112
- photo = MiniExiftool.new 'photo.jpg'
113
- photo.comment = 'hello world'
114
- photo.save
115
-
116
-
117
- === Save Is Atomar
118
-
119
- If you have changed serval values and call the +save+-method either
120
- all changes will be written to the file or nothing. The return value
121
- of the +save+-method is +true+ if all values are written to the file
122
- otherwise save returns +false+. In the last case you can use the
123
- +errors+-method which returns a hash of the tags which values couldn't
124
- be writed with an error message for each of them.
125
-
126
-
127
- === Interesting Methods
128
-
129
- Have a look at the <code>changed?</code>-method for checking if the
130
- value of a specific tag is changed or a changing in general is
131
- done. In the same way the +revert+-method reverts the value of a
132
- specific tag or in general all changes.
133
-
134
- You should also look at the rdoc information of MiniExiftool.
135
-
136
- === Further Examples
137
-
138
- See external_photo.rb[link://file.external_photo.html], print_portraits.rb[link://file.print_portraits.html] and shift_time.rb[link://file.shift_time.html] in the +examples+ directory.
139
-
@@ -1,22 +0,0 @@
1
- # -- encoding: utf-8 --
2
- require 'open-uri'
3
- require 'rubygems'
4
- require 'mini_exiftool'
5
-
6
- unless ARGV.size == 1
7
- puts "usage: ruby #{__FILE__} URI"
8
- puts " i.e.: ruby #{__FILE__} http://www.23hq.com/janfri/photo/1535332/large"
9
- exit -1
10
- end
11
-
12
- # Fetch an external photo
13
- filename = open(ARGV.first).path
14
-
15
- # Read the metadata
16
- photo = MiniExiftool.new filename
17
-
18
- # Print the metadata
19
- photo.tags.sort.each do |tag|
20
- # puts "#{tag}: #{photo[tag]}"
21
- puts tag.ljust(28) + photo[tag].to_s
22
- end
@@ -1,27 +0,0 @@
1
- # -- encoding: utf-8 --
2
- require 'rubygems'
3
- require 'mini_exiftool'
4
-
5
- unless ARGV.size > 0
6
- puts "usage: ruby #{__FILE__} FILES"
7
- puts " i.e.: ruby #{__FILE__} *.jpg"
8
- exit -1
9
- end
10
-
11
- # Loop at all given files
12
- ARGV.each do |filename|
13
- # If a given file isn't a photo MiniExiftool new method will throw
14
- # an exception this we will catch
15
- begin
16
- photo = MiniExiftool.new filename
17
- height = photo.image_height
18
- width = photo.image_width
19
- # We define portait as a photo wich ratio of height to width is
20
- # larger than 0.7
21
- if height / width > 0.7
22
- puts filename
23
- end
24
- rescue MiniExiftool::Error => e
25
- $stderr.puts e.message
26
- end
27
- end
@@ -1,30 +0,0 @@
1
- # -- encoding: utf-8 --
2
- require 'rubygems'
3
- require 'mini_exiftool'
4
-
5
- if ARGV.size < 2
6
- puts "usage: ruby #{__FILE__} [+|-]SECONDS FILES"
7
- puts " i.e.: ruby #{__FILE__} 3600 *.jpg"
8
- exit -1
9
- end
10
-
11
- delta = ARGV.shift.to_i
12
-
13
- ARGV.each do |filename|
14
- begin
15
- photo = MiniExiftool.new filename
16
- rescue MiniExiftool::Error => e
17
- $stderr.puts e.message
18
- exit -1
19
- end
20
- time = photo.date_time_original
21
- # time is a Time object, so we can use the methods of it :)
22
- photo.date_time_original = time + delta
23
- save_ok = photo.save
24
- if save_ok
25
- fmt = '%Y-%m-%d %H:%M:%S'
26
- puts "#{filename} changed: #{time.strftime(fmt)} -> #{(time + delta).strftime(fmt)}"
27
- else
28
- puts "#{filename} could not be changed"
29
- end
30
- end
@@ -1,31 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
- Gem::Specification.new do |s|
4
- s.name = "mini_exiftool"
5
- s.version = "1.5.1"
6
-
7
- s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
- s.authors = ["Jan Friedrich"]
9
- s.date = "2012-05-31"
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.rdoc", "Tutorial.rdoc", "lib/mini_exiftool.rb"]
13
- s.files = ["COPYING", "Changelog", "Manifest", "README.rdoc", "Rakefile", "TODO", "Tutorial.rdoc", ".yardopts", "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", "test/test_bad_preview_ifd.rb"]
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.rdoc"]
17
- s.require_paths = ["lib"]
18
- s.rubyforge_project = "mini_exiftool"
19
- s.rubygems_version = "1.8.24"
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_bad_preview_ifd.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"]
22
-
23
- if s.respond_to? :specification_version then
24
- s.specification_version = 3
25
-
26
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
27
- else
28
- end
29
- else
30
- end
31
- end