filentory-cli 0.5.0 → 0.6.0

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
- SHA1:
3
- metadata.gz: e8f9a1009ee774281cd518697359ce73b90af49b
4
- data.tar.gz: ea7368238fb810c1d1f63b48adbc489eed3b4829
2
+ SHA256:
3
+ metadata.gz: 8025b30dc7c2e2477a598eae39b2b6f97b5c3d943e20c86ab91afc79dbf09da6
4
+ data.tar.gz: 96fe3c7a799792f9f9795d1422c305dbe4a982655278cdad3d0ef4f9b3124a10
5
5
  SHA512:
6
- metadata.gz: 768e1102552618c60f91c7642cd84d396615c751f600b6b57961d3aed77da19efaddf793bf77c9d9815edead20697618b3636452b2e69c3aea75df7db33aac13
7
- data.tar.gz: 20b651a104470a1f881dc15c783518430eb3fce2f5210ce0c06324df975131041254c5238411ec34af6caa184128f7378073125ba3d34556b7693bec463fd128
6
+ metadata.gz: 73acadfa4e80f30b1e8e09df60e9f0cdac59195cc97e32767f512852870f55864a6ae4407aa0586a4517eb2c4592d055cce958452460a3294465c084c853130b
7
+ data.tar.gz: c9daa0c46a00ecb055ab672cc419e1a756b688f6f474ad60ab38b473333f6b753e105b30f74ba518a2d29b759abd9be8efc0cface2ac1c2878d937b633595e08
@@ -1,21 +1,28 @@
1
1
  require 'simplecov'
2
2
  require 'aruba/cucumber'
3
3
  require 'methadone/cucumber'
4
- require "json_spec/cucumber"
5
- require 'fakeweb'
6
- require 'rack/test'
7
-
8
- ENV['PATH'] = "#{File.expand_path(File.dirname(__FILE__) + '/../../bin')}#{File::PATH_SEPARATOR}#{ENV['PATH']}"
9
- LIB_DIR = File.join(File.expand_path(File.dirname(__FILE__)),'..','..','lib')
4
+ require 'json_spec/cucumber'
10
5
 
6
+ PROJECT_ROOT = File.join(File.dirname(__FILE__),'..','..')
7
+ ENV['PATH'] = "#{File.join(PROJECT_ROOT,'bin')}#{File::PATH_SEPARATOR}#{ENV['PATH']}"
8
+ ARUBA_DIR = File.join(%w(tmp aruba))
11
9
  Before do
12
- # Using "announce" causes massive warnings on 1.9.2
10
+ @dirs = [ARUBA_DIR]
13
11
  @puts = true
12
+ @aruba_timeout_seconds = 60
14
13
  @original_rubylib = ENV['RUBYLIB']
15
- ENV['RUBYLIB'] = LIB_DIR + File::PATH_SEPARATOR + ENV['RUBYLIB'].to_s
14
+ @original_rubyopt = ENV['RUBYOPT']
15
+
16
+ # We want to use, hopefully, the methadone from this codebase and not
17
+ # the gem, so we put it in the RUBYLIB
18
+ ENV['RUBYLIB'] = File.join(PROJECT_ROOT,'lib') + File::PATH_SEPARATOR + ENV['RUBYLIB'].to_s
16
19
 
20
+ # We need -rubygems here so that 1.8-style rubies work AND travis-ci doesn't barf with it in the shebang line
21
+ ENV['RUBYOPT'] = (ENV['RUBYOPT'] || '') + ' -rubygems'
17
22
  end
18
23
 
19
24
  After do
20
- ENV['RUBYLIB'] = @original_rubylib
21
- end
25
+ # Put back how it was
26
+ ENV['RUBYLIB'] = @original_rubylib
27
+ ENV['RUBYOPT'] = @original_rubyopt
28
+ end
@@ -1,6 +1,5 @@
1
1
  require 'exifr'
2
2
  require 'xmp'
3
- require 'string-scrub'
4
3
 
5
4
  class ExifExtractor
6
5
 
@@ -30,22 +29,26 @@ class ExifExtractor
30
29
  def extract_xmp_meta_data(img, xmpValues)
31
30
  xmp = XMP.parse(img)
32
31
  xmp.namespaces.each do |namespace_name|
33
- namespace = xmp.send(namespace_name)
34
- namespace.attributes.each do |attr|
35
- begin
36
- returnval = namespace.send(attr)#.inspect
37
- #puts "returnval: #{returnval}"
38
- answer = returnval.scrub("*")
39
- xmpValues["#{namespace_name}.#{attr}"] = answer.strip.to_s[0...250]
40
- rescue => error
41
- #puts error
42
- end
43
- end
44
- end
32
+ namespace = xmp.send(namespace_name)
33
+ extract_namespace_attributes(namespace_name, namespace, xmpValues)
34
+ end
45
35
  rescue => error
46
36
  #puts error
47
37
  end
48
38
 
39
+ def extract_namespace_attributes(namespace_name, namespace, xmpValues)
40
+ namespace.attributes.each do |attr|
41
+ begin
42
+ returnval = namespace.send(attr)#.inspect
43
+ #puts "returnval: #{returnval}"
44
+ answer = returnval.scrub("*")
45
+ xmpValues["#{namespace_name}.#{attr}"] = answer.strip.to_s[0...250]
46
+ rescue => error
47
+ #puts error
48
+ end
49
+ end
50
+ end
51
+
49
52
  def extract_exif_main_meta_data(img, xmpValues)
50
53
  xmpValues["exif.model"] = cleanup_description(img.model)
51
54
  xmpValues["exif.make"] = cleanup_description(img.make)
@@ -68,18 +71,17 @@ class ExifExtractor
68
71
 
69
72
  def extract_gps_infos(img, xmpValues)
70
73
  if img.gps
74
+ assing_value_when_field_is_set(img.gps, :latitude, "exif.gps.latitude", xmpValues)
71
75
 
72
- if !img.gps.latitude.nil? && !img.gps.latitude.nan? then
73
- xmpValues["exif.gps.latitude"] = img.gps.latitude
74
- end
75
-
76
- if !img.gps.longitude.nil? && !img.gps.longitude.nan? then
77
- xmpValues["exif.gps.longitude"] = img.gps.longitude
78
- end
76
+ assing_value_when_field_is_set(img.gps, :longitude, "exif.gps.longitude", xmpValues)
79
77
 
80
- if !img.gps.altitude.nil? && !img.gps.altitude.nan? then
81
- xmpValues["exif.gps.altitude"] = img.gps.altitude
82
- end
78
+ assing_value_when_field_is_set(img.gps, :altitude, "exif.gps.altitude", xmpValues)
79
+ end
80
+ end
81
+
82
+ def assing_value_when_field_is_set(img, method, key_in_array, xmpValues)
83
+ if !img.send(method).nil? && !img.send(method).nan?
84
+ xmpValues[key_in_array] = img.send(method)
83
85
  end
84
86
  end
85
87
 
@@ -1,3 +1,3 @@
1
1
  module Filentory
2
- VERSION = "0.5.0"
2
+ VERSION = "0.6.0"
3
3
  end
@@ -0,0 +1,32 @@
1
+ require File.expand_path '../test_helper.rb', __FILE__
2
+ require 'minitest/autorun'
3
+ require 'filentory/collector'
4
+ require 'filentory'
5
+ require 'mkfifo'
6
+
7
+ class TestGPSInfo < Minitest::Test
8
+
9
+ def test_latitude_is_set
10
+ result = fetch_gps_result()
11
+ assert_equal(36.98276, result[0].metadata["exif.gps.latitude"])
12
+ end
13
+
14
+ def test_longitude_is_set
15
+ result = fetch_gps_result()
16
+ assert_equal(-110.11164666666667, result[0].metadata["exif.gps.longitude"])
17
+ end
18
+
19
+ def test_altitude_is_set
20
+ result = fetch_gps_result()
21
+ assert_equal(1709.4, result[0].metadata["exif.gps.altitude"])
22
+ end
23
+
24
+ private
25
+ def fetch_gps_result()
26
+ col = Collector.new
27
+ result = col.collect(File.dirname(__FILE__)+"/integration/gps/")
28
+ #puts "The result is: #{result}"
29
+ assert_equal(1, result.length)
30
+ result
31
+ end
32
+ end
@@ -10,7 +10,7 @@ class TestVideoExtractor < Minitest::Test
10
10
  metadata = extractor.metadata_for_file(File.dirname(__FILE__)+"/integration/data/video.mov")
11
11
 
12
12
  assert_in_delta(2.18, metadata["duration"], 0.05)
13
- assert_equal("568x320", metadata["resolution"])
13
+ assert_equal("320x568", metadata["resolution"])
14
14
  end
15
15
 
16
16
  def test_can_handle_avi
data/test/test_helper.rb CHANGED
@@ -1 +1,2 @@
1
- require 'simplecov'
1
+ require 'simplecov'
2
+ SimpleCov.command_name 'test:units'
metadata CHANGED
@@ -1,57 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: filentory-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Johnny Graber
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-10 00:00:00.000000000 Z
11
+ date: 2019-01-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rdoc
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '6.1'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: '6.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: aruba
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: '0.14'
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
- version: '0'
40
+ version: '0.14'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '10.3'
47
+ version: '12.3'
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
- version: '10.3'
54
+ version: '12.3'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: fakeweb
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -72,84 +72,84 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 1.6.1
75
+ version: 2.0.6
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
- version: 1.6.1
82
+ version: 2.0.6
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rack-test
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '0.6'
89
+ version: '1.1'
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
- version: '0.6'
96
+ version: '1.1'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: minitest
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ">="
101
+ - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '0'
103
+ version: '5.11'
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
- version: '0'
110
+ version: '5.11'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: mkfifo
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ">="
115
+ - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '0'
117
+ version: '0.1'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ">="
122
+ - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: '0'
124
+ version: '0.1'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: methadone
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '1.7'
131
+ version: '2.0'
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: '1.7'
138
+ version: '2.0'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: oj
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: '2.11'
145
+ version: '3.7'
146
146
  type: :runtime
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: '2.11'
152
+ version: '3.7'
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: json_spec
155
155
  requirement: !ruby/object:Gem::Requirement
@@ -170,14 +170,14 @@ dependencies:
170
170
  requirements:
171
171
  - - "~>"
172
172
  - !ruby/object:Gem::Version
173
- version: 1.2.0
173
+ version: 1.3.0
174
174
  type: :runtime
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - "~>"
179
179
  - !ruby/object:Gem::Version
180
- version: 1.2.0
180
+ version: 1.3.0
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: xmp
183
183
  requirement: !ruby/object:Gem::Requirement
@@ -198,68 +198,38 @@ dependencies:
198
198
  requirements:
199
199
  - - "~>"
200
200
  - !ruby/object:Gem::Version
201
- version: 1.0.0
201
+ version: '3.0'
202
202
  type: :runtime
203
203
  prerelease: false
204
204
  version_requirements: !ruby/object:Gem::Requirement
205
205
  requirements:
206
206
  - - "~>"
207
207
  - !ruby/object:Gem::Version
208
- version: 1.0.0
209
- - !ruby/object:Gem::Dependency
210
- name: string-scrub
211
- requirement: !ruby/object:Gem::Requirement
212
- requirements:
213
- - - ">="
214
- - !ruby/object:Gem::Version
215
- version: '0'
216
- type: :runtime
217
- prerelease: false
218
- version_requirements: !ruby/object:Gem::Requirement
219
- requirements:
220
- - - ">="
221
- - !ruby/object:Gem::Version
222
- version: '0'
208
+ version: '3.0'
223
209
  - !ruby/object:Gem::Dependency
224
210
  name: simplecov
225
211
  requirement: !ruby/object:Gem::Requirement
226
212
  requirements:
227
213
  - - "~>"
228
214
  - !ruby/object:Gem::Version
229
- version: 0.10.0
215
+ version: '0.16'
230
216
  type: :development
231
217
  prerelease: false
232
218
  version_requirements: !ruby/object:Gem::Requirement
233
219
  requirements:
234
220
  - - "~>"
235
221
  - !ruby/object:Gem::Version
236
- version: 0.10.0
222
+ version: '0.16'
237
223
  description: A tool to create an inventory of a storage medium
238
224
  email:
239
225
  - jg@jgraber.ch
240
- executables:
241
- - filentory-cli
226
+ executables: []
242
227
  extensions: []
243
228
  extra_rdoc_files: []
244
229
  files:
245
- - ".gitignore"
246
- - ".simplecov"
247
- - ".travis.yml"
248
- - Gemfile
249
- - Gemfile.lock
250
- - LICENSE
251
- - README.md
252
- - README.rdoc
253
- - Rakefile
254
- - bin/filentory-cli
255
- - features/filentory-cli.feature
256
230
  - features/step_definitions/filentory-cli_steps.rb
257
- - features/support/auth.yaml
258
- - features/support/config.ru
259
231
  - features/support/demoserver.rb
260
232
  - features/support/env.rb
261
- - filentory-cli.gemspec
262
- - filentory.yaml.template
263
233
  - lib/filentory.rb
264
234
  - lib/filentory/collector.rb
265
235
  - lib/filentory/datastore.rb
@@ -268,17 +238,11 @@ files:
268
238
  - lib/filentory/sender.rb
269
239
  - lib/filentory/version.rb
270
240
  - lib/filentory/videoextractor.rb
271
- - results.html
272
- - test/integration/data/fileA.txt
273
- - test/integration/data/folder/fileB.txt
274
- - test/integration/data/image_with_exif_and_xmp_infos.jpg
275
- - test/integration/data/video.mov
276
- - test/integration/special/.gitignore
277
- - test/integration/special/exif.jpg
278
241
  - test/tc_collector.rb
279
242
  - test/tc_datastore.rb
280
243
  - test/tc_exifextractor.rb
281
244
  - test/tc_fileentry.rb
245
+ - test/tc_gps_info.rb
282
246
  - test/tc_logging.rb
283
247
  - test/tc_sender.rb
284
248
  - test/tc_something.rb
@@ -287,7 +251,7 @@ files:
287
251
  - test/test_helper.rb
288
252
  homepage: https://github.com/jgraber/filentory-cli
289
253
  licenses:
290
- - Apache License, Version 2.0
254
+ - Apache-2.0
291
255
  metadata: {}
292
256
  post_install_message:
293
257
  rdoc_options: []
@@ -304,29 +268,20 @@ required_rubygems_version: !ruby/object:Gem::Requirement
304
268
  - !ruby/object:Gem::Version
305
269
  version: '0'
306
270
  requirements: []
307
- rubyforge_project:
308
- rubygems_version: 2.4.5.1
271
+ rubygems_version: 3.0.1
309
272
  signing_key:
310
273
  specification_version: 4
311
274
  summary: Filentory-cli is a first step to get order in a chaotic collection of storage
312
275
  medias.
313
276
  test_files:
314
- - features/filentory-cli.feature
315
277
  - features/step_definitions/filentory-cli_steps.rb
316
- - features/support/auth.yaml
317
- - features/support/config.ru
318
278
  - features/support/demoserver.rb
319
279
  - features/support/env.rb
320
- - test/integration/data/fileA.txt
321
- - test/integration/data/folder/fileB.txt
322
- - test/integration/data/image_with_exif_and_xmp_infos.jpg
323
- - test/integration/data/video.mov
324
- - test/integration/special/.gitignore
325
- - test/integration/special/exif.jpg
326
280
  - test/tc_collector.rb
327
281
  - test/tc_datastore.rb
328
282
  - test/tc_exifextractor.rb
329
283
  - test/tc_fileentry.rb
284
+ - test/tc_gps_info.rb
330
285
  - test/tc_logging.rb
331
286
  - test/tc_sender.rb
332
287
  - test/tc_something.rb