exiftool 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- ZjVlYjBlMzMxZDcwYTgxODkyYzBlNmM1NjczZDYyMDRkOGEzNGNkNA==
5
- data.tar.gz: !binary |-
6
- NWQ1NjliOTM4NTVlNDYwODBkMmIxNzQyN2EyMTNkZDkxNWNkMDlmZQ==
2
+ SHA1:
3
+ metadata.gz: 98d9e0ee7c86532f33548687b8fb945837823118
4
+ data.tar.gz: 8e4b81b3700c9671df2d413604d8b1f823027ce0
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- M2FhZmFhY2MwYzg3YzU5Y2MyYWFkNGU5NzdiZjQ1YjJlODRmMzc3Y2QxMWIw
10
- NmIxM2JkMjE4NTcwMzg5MjY3YmYzNjdlZjMzMWJjODc5NGZhY2NlMjJlNDUw
11
- NDY1M2JiYmM3YWE5NjE0MGFjODc2ZjUzMGFmNTU1ODFhMTlkNDY=
12
- data.tar.gz: !binary |-
13
- MDdiMTAxNWI5YjkwZWZmYjViOTQwNWNjODlhNDI1ZGIwZTUyYzZiYmRhMGRj
14
- YzAwMTkwMDFmOWU4ZDAxMTU3NjNiNWIyZDYyNTI4ZTg5ZmMxYjZlMWFlNzQ1
15
- OWUxYjdhNzgyY2ZiODczZGNiYTc2MmJkNjJiNzExODJjNjk0M2M=
6
+ metadata.gz: fbbe8ee348fc62382aad388602186ace54cf1527df8e5a90cef20b15bc3e347b8420e52977719026117e9aab35ee1f560bb7e31cbc54050849bced76018bca6a
7
+ data.tar.gz: b62e43cdcfd58cc7f18805050c4b0818fbb901659b2e000f4bdc936c6f14ccf183400c9689b6f1d646bcceaafed2d6339229bf2b5868ad8045c1b689eac03db5
@@ -6,6 +6,8 @@ class Exiftool
6
6
 
7
7
  WORD_BOUNDARY_RES = [/([A-Z\d]+)([A-Z][a-z])/, /([a-z\d])([A-Z])/]
8
8
  FRACTION_RE = /^(\d+)\/(\d+)$/
9
+ YMD_RE = /\A(\d{4}):(\d{2}):(\d{2})\b/
10
+ ZERO_DATE_RE = /\A[+:0 ]+\z/
9
11
 
10
12
  attr_reader :key, :display_key, :sym_key, :raw_value
11
13
 
@@ -17,43 +19,51 @@ class Exiftool
17
19
  end
18
20
 
19
21
  def value
20
- for_lat_long ||
21
- for_date ||
22
- for_fraction ||
22
+ @value ||= if lat_long?
23
+ as_lat_long
24
+ elsif date?
25
+ as_date
26
+ elsif fraction?
27
+ as_fraction
28
+ else
23
29
  raw_value
30
+ end
24
31
  rescue StandardError => e
25
32
  "Warning: Parsing '#{raw_value}' for attribute '#{key}' raised #{e.message}"
26
33
  end
27
34
 
28
- YMD_RE = /\A(\d{4}):(\d{2}):(\d{2})\b/
29
-
30
35
  def civil_date
31
- if datish?
36
+ if date? && !zero_date?
32
37
  ymd = raw_value.scan(YMD_RE).first
33
- Date.civil(*ymd.map{|ea|ea.to_i}) if ymd
38
+ Date.civil(*ymd.map { |ea| ea.to_i }) if ymd
34
39
  end
35
40
  end
36
41
 
37
42
  private
38
43
 
39
- def for_lat_long
40
- if sym_key == :gps_latitude || sym_key == :gps_longitude
41
- value, direction = raw_value.split(" ")
42
- if value =~ /\A\d+\.?\d*\z/
43
- value.to_f * (['S', 'W'].include?(direction) ? -1 : 1)
44
- end
44
+ def lat_long?
45
+ sym_key == :gps_latitude || sym_key == :gps_longitude
46
+ end
47
+
48
+ def as_lat_long
49
+ value, direction = raw_value.split(' ')
50
+ if value =~ /\A\d+\.?\d*\z/
51
+ value.to_f * (['S', 'W'].include?(direction) ? -1 : 1)
45
52
  end
46
53
  end
47
54
 
48
- def datish?
55
+ def date?
49
56
  raw_value.is_a?(String) && display_key =~ /\bdate\b/i
50
57
  end
51
58
 
52
- def for_date
53
- if datish?
54
- try_parse { Time.strptime(raw_value, '%Y:%m:%d %H:%M:%S%z') } ||
55
- try_parse { Time.strptime(raw_value, '%Y:%m:%d %H:%M:%S.%L%z') }
56
- end
59
+ def zero_date?
60
+ raw_value =~ ZERO_DATE_RE
61
+ end
62
+
63
+ def as_date
64
+ try_parse { Time.strptime(raw_value, '%Y:%m:%d %H:%M:%S%z') } ||
65
+ try_parse { Time.strptime(raw_value, '%Y:%m:%d %H:%M:%S.%L%z') } ||
66
+ raw_value
57
67
  end
58
68
 
59
69
  def try_parse
@@ -62,11 +72,13 @@ class Exiftool
62
72
  nil
63
73
  end
64
74
 
65
- def for_fraction
66
- if raw_value.is_a?(String)
67
- scan = raw_value.scan(FRACTION_RE).first
68
- v = Rational(*scan.map { |ea| ea.to_i }) unless scan.nil?
69
- end
75
+ def fraction?
76
+ raw_value.is_a?(String) && raw_value =~ FRACTION_RE
77
+ end
78
+
79
+ def as_fraction
80
+ scan = raw_value.scan(FRACTION_RE).first
81
+ Rational(*scan.map { |ea| ea.to_i }) unless scan.nil?
70
82
  end
71
83
  end
72
84
  end
@@ -1,3 +1,3 @@
1
1
  class Exiftool
2
- VERSION = Gem::Version.new('0.6.0')
2
+ VERSION = Gem::Version.new('0.7.0')
3
3
  end
metadata CHANGED
@@ -1,111 +1,111 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: exiftool
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew McEachen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-01 00:00:00.000000000 Z
11
+ date: 2015-08-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ! '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ! '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ! '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
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
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ! '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ! '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: yard
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ! '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ! '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: minitest
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ! '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
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
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: minitest-great_expectations
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ! '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ! '>='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: minitest-reporters
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ! '>='
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ! '>='
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  description: Multiget ExifTool wrapper for ruby
@@ -129,18 +129,18 @@ require_paths:
129
129
  - lib
130
130
  required_ruby_version: !ruby/object:Gem::Requirement
131
131
  requirements:
132
- - - ! '>='
132
+ - - ">="
133
133
  - !ruby/object:Gem::Version
134
134
  version: '0'
135
135
  required_rubygems_version: !ruby/object:Gem::Requirement
136
136
  requirements:
137
- - - ! '>='
137
+ - - ">="
138
138
  - !ruby/object:Gem::Version
139
139
  version: '0'
140
140
  requirements:
141
141
  - ExifTool (see http://www.sno.phy.queensu.ca/~phil/exiftool/)
142
142
  rubyforge_project:
143
- rubygems_version: 2.1.10
143
+ rubygems_version: 2.2.2
144
144
  signing_key:
145
145
  specification_version: 4
146
146
  summary: Multiget ExifTool wrapper for ruby