mini_exiftool 0.3.0 → 0.3.1
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.
- data/README +1 -1
- data/Tutorial +2 -2
- data/lib/mini_exiftool.rb +17 -17
- metadata +2 -2
data/README
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
= MiniExiftool
|
2
2
|
|
3
3
|
This library is wrapper for the Exiftool command-line application
|
4
|
-
(http://www.sno.phy.queensu.ca/~phil/exiftool/) written by Phil
|
4
|
+
(http://www.sno.phy.queensu.ca/~phil/exiftool/) written by Phil Harvey.
|
5
5
|
Read and write access is done in a clean OO manner.
|
6
6
|
|
7
7
|
== Requirements
|
data/Tutorial
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
== Installation
|
5
5
|
|
6
|
-
* Installing the Exiftool command-line application from Phil
|
6
|
+
* Installing the Exiftool command-line application from Phil Harvey
|
7
7
|
(see http://www.sno.phy.queensu.ca/~phil/exiftool/install.html)
|
8
8
|
* Installing the Ruby library (<code>gem install mini_exiftool</code>)
|
9
9
|
|
@@ -57,7 +57,7 @@ combining with calling <code>reload</code>.
|
|
57
57
|
Let's make an example:
|
58
58
|
# standard: numerical is false
|
59
59
|
photo = MiniExiftool.new 'photo.jpg'
|
60
|
-
photo.exposure_time # => '1/
|
60
|
+
photo.exposure_time # => '1/60' (String)
|
61
61
|
# now with numerical is true
|
62
62
|
photo.numerical = true
|
63
63
|
photo.reload
|
data/lib/mini_exiftool.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
#
|
4
4
|
# This library is wrapper for the Exiftool command-line
|
5
5
|
# application (http://www.sno.phy.queensu.ca/~phil/exiftool/)
|
6
|
-
# written by Phil
|
6
|
+
# written by Phil Harvey.
|
7
7
|
# Read and write access is done in a clean OO manner.
|
8
8
|
#
|
9
9
|
# Author: Jan Friedrich
|
@@ -25,7 +25,7 @@ class MiniExiftool
|
|
25
25
|
attr_reader :filename
|
26
26
|
attr_accessor :numerical, :composite, :errors
|
27
27
|
|
28
|
-
VERSION = '0.3.
|
28
|
+
VERSION = '0.3.1'
|
29
29
|
|
30
30
|
# opts support at the moment
|
31
31
|
# * <code>:numerical</code> for numerical values, default is +false+
|
@@ -43,7 +43,7 @@ class MiniExiftool
|
|
43
43
|
load filename
|
44
44
|
end
|
45
45
|
|
46
|
-
# Load the tags of filename
|
46
|
+
# Load the tags of filename.
|
47
47
|
def load filename
|
48
48
|
if filename.nil? || !File.exists?(filename)
|
49
49
|
raise MiniExiftool::Error.new("File '#{filename}' does not exist.")
|
@@ -66,23 +66,23 @@ class MiniExiftool
|
|
66
66
|
self
|
67
67
|
end
|
68
68
|
|
69
|
-
# Reload the tags of an already readed file
|
69
|
+
# Reload the tags of an already readed file.
|
70
70
|
def reload
|
71
71
|
load @filename
|
72
72
|
end
|
73
73
|
|
74
|
-
# Returns the value of a tag
|
74
|
+
# Returns the value of a tag.
|
75
75
|
def [] tag
|
76
76
|
@changed_values[tag] || @values[tag]
|
77
77
|
end
|
78
78
|
|
79
|
-
# Set the value of a tag
|
79
|
+
# Set the value of a tag.
|
80
80
|
def []=(tag, val)
|
81
81
|
@changed_values[tag] = val
|
82
82
|
end
|
83
83
|
|
84
|
-
#
|
85
|
-
# given tag is changed
|
84
|
+
# Returns true if any tag value is changed or if the value of a
|
85
|
+
# given tag is changed.
|
86
86
|
def changed? tag=false
|
87
87
|
if tag
|
88
88
|
@changed_values.include? tag
|
@@ -91,7 +91,7 @@ class MiniExiftool
|
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
94
|
-
# Revert all changes or the change of a given tag
|
94
|
+
# Revert all changes or the change of a given tag.
|
95
95
|
def revert tag=nil
|
96
96
|
if tag
|
97
97
|
val = @changed_values.delete(tag)
|
@@ -103,17 +103,17 @@ class MiniExiftool
|
|
103
103
|
res
|
104
104
|
end
|
105
105
|
|
106
|
-
# Returns an array of the tags (original tag names) of the readed file
|
106
|
+
# Returns an array of the tags (original tag names) of the readed file.
|
107
107
|
def tags
|
108
108
|
@values.keys.map { |key| @tag_names[key] }
|
109
109
|
end
|
110
110
|
|
111
|
-
# Returns an array of all changed tags
|
111
|
+
# Returns an array of all changed tags.
|
112
112
|
def changed_tags
|
113
113
|
@changed_values.keys.map { |key| @tag_names[key] }
|
114
114
|
end
|
115
115
|
|
116
|
-
# Save the changes to the file
|
116
|
+
# Save the changes to the file.
|
117
117
|
def save
|
118
118
|
return false if @changed_values.empty?
|
119
119
|
@errors.clear
|
@@ -140,19 +140,19 @@ class MiniExiftool
|
|
140
140
|
all_ok
|
141
141
|
end
|
142
142
|
|
143
|
-
# Returns the command name of the called Exiftool application
|
143
|
+
# Returns the command name of the called Exiftool application.
|
144
144
|
def self.command
|
145
145
|
@@cmd
|
146
146
|
end
|
147
147
|
|
148
|
-
# Setting the command name of the called Exiftool application
|
148
|
+
# Setting the command name of the called Exiftool application.
|
149
149
|
def self.command= cmd
|
150
150
|
@@cmd = cmd
|
151
151
|
end
|
152
152
|
|
153
153
|
@@writable_tags = Set.new
|
154
154
|
|
155
|
-
# Returns a set of all possible writable tags of Exiftool
|
155
|
+
# Returns a set of all possible writable tags of Exiftool.
|
156
156
|
def self.writable_tags
|
157
157
|
if @@writable_tags.empty?
|
158
158
|
lines = `#{@@cmd} -listw`
|
@@ -165,7 +165,7 @@ class MiniExiftool
|
|
165
165
|
@@writable_tags
|
166
166
|
end
|
167
167
|
|
168
|
-
# Returns the version of the Exiftool command-line application
|
168
|
+
# Returns the version of the Exiftool command-line application.
|
169
169
|
def self.exiftool_version
|
170
170
|
output = `#{MiniExiftool.command} -ver 2>&1`
|
171
171
|
unless $?.exitstatus == 0
|
@@ -249,7 +249,7 @@ class MiniExiftool
|
|
249
249
|
|
250
250
|
# Hash with indifferent access:
|
251
251
|
# DateTimeOriginal == datetimeoriginal == date_time_original
|
252
|
-
class TagHash < Hash
|
252
|
+
class TagHash < Hash # :nodoc:
|
253
253
|
def[] k
|
254
254
|
super(unify(k))
|
255
255
|
end
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.1
|
|
3
3
|
specification_version: 1
|
4
4
|
name: mini_exiftool
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.3.
|
7
|
-
date: 2007-
|
6
|
+
version: 0.3.1
|
7
|
+
date: 2007-06-21 00:00:00 +02:00
|
8
8
|
summary: A library for nice OO access to the Exiftool command-line application written by Phil Harvey.
|
9
9
|
require_paths:
|
10
10
|
- lib
|