mini_exiftool 2.7.1 → 2.7.2

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
  SHA1:
3
- metadata.gz: b344346a14c755d2136986594dbfd8005a77c29b
4
- data.tar.gz: 9f3217fbf1feff109c53eaf6f1c59bd42708c5db
3
+ metadata.gz: dfb5db778023608bdf498eb491daac4f714dad7e
4
+ data.tar.gz: da076263f73f0d6f7eccd407ca4dad676f34c940
5
5
  SHA512:
6
- metadata.gz: 7c4f6fc129da87f4c5bea1a6c6d4e909ca26a6dd0115f4b514fdafb5300433f25975789b2873d3b64f4a1a7bfd3b80e2b29519f79bb2f67b3282014cfba99fa2
7
- data.tar.gz: 2040f7e6476d528cc16b40ea602a5aeedcca11c86fd320c548b947413b160d3d0e9d2073b1fff0cfd9ec426dde9f51c075f26d8d6e75a1cddb78a875bc6ce4ef
6
+ metadata.gz: db1e8de31890df5c85ca5ebd21e04e2c710a70b741bc9e2a1646eee44e020bd6cad9035d645af258e6d8f4b0749d9ce73f467052ad87f69ab405d75525c3e43a
7
+ data.tar.gz: 0388c15b6d5dd605d3ed87be5f505ab50db6260b540a38719f7f93abd9dc6250d55ecb5b19b168c4db5f1a993ad22e334501c728db224a00d08ee6f05613099b
data/Changelog CHANGED
@@ -1,3 +1,6 @@
1
+ 2.7.2
2
+ - Include example files in gem.
3
+
1
4
  2.7.1
2
5
  - Improve test for fast options: Ignore other messages from stderr.
3
6
  - Fix typo in license identifier.
data/Rakefile CHANGED
@@ -14,6 +14,7 @@ Rim.setup do |p|
14
14
  p.homepage = 'http://gitorious.org/mini_exiftool'
15
15
  p.license = 'LGPL-2.1'
16
16
  p.gem_files << 'Tutorial.rdoc'
17
+ p.gem_files += FileList.new('examples/**')
17
18
  p.install_message = %q{
18
19
  +-----------------------------------------------------------------------+
19
20
  | Please ensure you have installed exiftool at least version 7.65 |
@@ -0,0 +1,20 @@
1
+ # -- encoding: utf-8 --
2
+ require 'mini_exiftool'
3
+
4
+ if ARGV.size < 2
5
+ puts "usage: ruby #{__FILE__} SOURCE_FILE TARGET_FILE"
6
+ exit -1
7
+ end
8
+
9
+ source_filename, target_filename = ARGV
10
+
11
+ begin
12
+ photo = MiniExiftool.new filename
13
+ # The second parameter of MiniExiftool#copy_tags_from
14
+ # could be a String, Symbol or an Array of Strings,
15
+ # Symbols
16
+ photo.copy_tags_from(target, 'icc_profile')
17
+ rescue MiniExiftool::Error => e
18
+ $stderr.puts e.message
19
+ exit -1
20
+ end
@@ -0,0 +1,22 @@
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
@@ -0,0 +1,27 @@
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
@@ -0,0 +1,30 @@
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
@@ -0,0 +1,126 @@
1
+ # -- encoding: utf-8 --
2
+ require 'mini_exiftool'
3
+ require 'open3'
4
+
5
+ unless ARGV.size == 1
6
+ puts "usage: ruby #{__FILE__} URI"
7
+ puts " i.e.: ruby #{__FILE__} http://farm6.staticflickr.com/5015/5458914734_8fd3f33278_o.jpg"
8
+ exit -1
9
+ end
10
+
11
+ arg = ARGV.shift
12
+
13
+ ####################################
14
+ # Helper methods
15
+ ####################################
16
+
17
+ def time
18
+ a = Time.now
19
+ yield
20
+ b = Time.now
21
+ b - a
22
+ end
23
+
24
+ def print_statistics name, without_fast, fast, fast2
25
+ puts '-' * 40
26
+ puts name, "\n"
27
+ puts format 'without fast: %0.2fs', without_fast
28
+ puts format 'fast : %0.2fs', fast
29
+ puts format 'fast2 : %0.2fs', fast2
30
+ puts
31
+ puts format 'speedup fast : %0.2f', without_fast / fast
32
+ puts format 'speedup fast2: %0.2f', without_fast / fast2
33
+ puts '-' * 40
34
+ puts
35
+ end
36
+
37
+ ####################################
38
+ # Plain Ruby with standard library
39
+ ####################################
40
+
41
+ require 'net/http'
42
+
43
+ uri = URI(arg)
44
+
45
+ def read_from_http uri, io
46
+ Thread.new(uri, io) do |uri, io|
47
+ Net::HTTP.start(uri.host, uri.port) do |http|
48
+ request = Net::HTTP::Get.new uri
49
+ http.request request do |response|
50
+ response.read_body do |chunk|
51
+ io.write chunk
52
+ end
53
+ end
54
+ end
55
+ io.close
56
+ end
57
+ end
58
+
59
+ without_fast = time do
60
+ output, input = IO.pipe
61
+ read_from_http uri, input
62
+ MiniExiftool.new output
63
+ end
64
+
65
+ fast = time do
66
+ output, input = IO.pipe
67
+ read_from_http uri, input
68
+ MiniExiftool.new output, fast: true
69
+ end
70
+
71
+ fast2 = time do
72
+ output, input = IO.pipe
73
+ read_from_http uri, input
74
+ MiniExiftool.new output, fast2: true
75
+ end
76
+
77
+ print_statistics 'net/http', without_fast, fast, fast2
78
+
79
+ ####################################
80
+ # curl
81
+ ####################################
82
+
83
+ without_fast = time do
84
+ input, output = Open3.popen3("curl -s #{arg}")
85
+ input.close
86
+ MiniExiftool.new output
87
+ end
88
+
89
+ fast = time do
90
+ input, output = Open3.popen3("curl -s #{arg}")
91
+ input.close
92
+ MiniExiftool.new output, fast: true
93
+ end
94
+
95
+ fast2 = time do
96
+ input, output = Open3.popen3("curl -s #{arg}")
97
+ input.close
98
+ MiniExiftool.new output, fast2: true
99
+ end
100
+
101
+ print_statistics 'curl', without_fast, fast, fast2
102
+
103
+ ####################################
104
+ # wget
105
+ ####################################
106
+
107
+ without_fast = time do
108
+ input, output = Open3.popen3("wget -q -O - #{arg}")
109
+ input.close
110
+ MiniExiftool.new output
111
+ end
112
+
113
+ fast = time do
114
+ input, output = Open3.popen3("wget -q -O - #{arg}")
115
+ input.close
116
+ MiniExiftool.new output, fast: true
117
+ end
118
+
119
+ fast2 = time do
120
+ input, output = Open3.popen3("wget -q -O - #{arg}")
121
+ input.close
122
+ MiniExiftool.new output, fast2: true
123
+ end
124
+
125
+ print_statistics 'wget', without_fast, fast, fast2
126
+
@@ -26,7 +26,7 @@ require 'time'
26
26
  # Simple OO access to the Exiftool command-line application.
27
27
  class MiniExiftool
28
28
 
29
- VERSION = '2.7.1'
29
+ VERSION = '2.7.2'
30
30
 
31
31
  # Name of the Exiftool command-line application
32
32
  @@cmd = 'exiftool'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mini_exiftool
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.1
4
+ version: 2.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Friedrich
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-07 00:00:00.000000000 Z
11
+ date: 2016-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rim
@@ -35,6 +35,11 @@ files:
35
35
  - README.rdoc
36
36
  - Rakefile
37
37
  - Tutorial.rdoc
38
+ - examples/copy_icc_profile.rb
39
+ - examples/external_photo.rb
40
+ - examples/print_portraits.rb
41
+ - examples/shift_time.rb
42
+ - examples/show_speedup_with_fast_option.rb
38
43
  - lib/mini_exiftool.rb
39
44
  - test/data/Bad_PreviewIFD.jpg
40
45
  - test/data/Canon.jpg
@@ -98,4 +103,3 @@ signing_key:
98
103
  specification_version: 4
99
104
  summary: This library is wrapper for the Exiftool command-line application (http://www.sno.phy.queensu.ca/~phil/exiftool).
100
105
  test_files: []
101
- has_rdoc: