hydra-works 1.0.0 → 1.1.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.
- checksums.yaml +5 -5
- data/.rubocop.yml +1 -0
- data/.rubocop_todo.yml +5 -0
- data/hydra-works.gemspec +3 -4
- data/lib/hydra/works/characterization/fits_document.rb +340 -164
- data/lib/hydra/works/models/concerns/collection_behavior.rb +44 -0
- data/lib/hydra/works/models/concerns/file_set_behavior.rb +20 -0
- data/lib/hydra/works/models/concerns/work_behavior.rb +54 -0
- data/lib/hydra/works/services/characterization_service.rb +1 -0
- data/lib/hydra/works/version.rb +1 -1
- data/lib/hydra/works/virus_scanner.rb +1 -1
- data/spec/hydra/works/models/collection_spec.rb +150 -0
- data/spec/hydra/works/models/file_set_spec.rb +47 -0
- data/spec/hydra/works/models/work_spec.rb +213 -7
- metadata +9 -40
- data/solr/config/_rest_managed.json +0 -3
- data/solr/config/admin-extra.html +0 -31
- data/solr/config/elevate.xml +0 -36
- data/solr/config/mapping-ISOLatin1Accent.txt +0 -246
- data/solr/config/protwords.txt +0 -21
- data/solr/config/schema.xml +0 -372
- data/solr/config/scripts.conf +0 -24
- data/solr/config/solrconfig.xml +0 -419
- data/solr/config/spellings.txt +0 -2
- data/solr/config/stopwords.txt +0 -58
- data/solr/config/stopwords_en.txt +0 -58
- data/solr/config/synonyms.txt +0 -31
- data/solr/config/xslt/example.xsl +0 -132
- data/solr/config/xslt/example_atom.xsl +0 -67
- data/solr/config/xslt/example_rss.xsl +0 -66
- data/solr/config/xslt/luke.xsl +0 -337
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f17bd910e50c6baeda9000b13a4f625615be042df52f102206b051dcb32c6039
|
4
|
+
data.tar.gz: ec76af677423c06b7bfe68e297aef518a8cd43ba5b4fbcffef7c9a8e55fe5312
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38064607b5073e2618072580e5f9b242666658fcd0d7415b819d2462b1f18fd1d20d350be64f10b268f88b8ea570b0055428d3e2932ddd8cb8b32c6cbf272944
|
7
|
+
data.tar.gz: 7a725c734c6bca2b25e62387f281013cc9dcaf55a8584cfa98318a5a74e6c644cbb75fefb53af81cc52a64e156aedd9bb9dc65b223c49fa73873706642a7d544
|
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
CHANGED
@@ -63,6 +63,7 @@ RSpec/NamedSubject:
|
|
63
63
|
RSpec/NestedGroups:
|
64
64
|
Exclude:
|
65
65
|
- 'spec/hydra/works/models/collection_spec.rb'
|
66
|
+
- 'spec/hydra/works/models/file_set_spec.rb'
|
66
67
|
- 'spec/hydra/works/models/work_spec.rb'
|
67
68
|
- 'spec/hydra/works/services/characterization_service_spec.rb'
|
68
69
|
- 'spec/hydra/works/services/virus_checker_service_spec.rb'
|
@@ -103,3 +104,7 @@ Style/NumericPredicate:
|
|
103
104
|
Exclude:
|
104
105
|
- 'spec/**/*'
|
105
106
|
- 'lib/hydra/works/virus_scanner.rb'
|
107
|
+
|
108
|
+
Style/FrozenStringLiteralComment:
|
109
|
+
Exclude:
|
110
|
+
- '**/*'
|
data/hydra-works.gemspec
CHANGED
@@ -19,18 +19,17 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
20
|
spec.require_paths = ['lib']
|
21
21
|
|
22
|
-
spec.add_dependency 'activesupport', '>= 4.2.10', '<
|
22
|
+
spec.add_dependency 'activesupport', '>= 4.2.10', '< 6.0'
|
23
23
|
spec.add_dependency 'hydra-derivatives', '~> 3.0'
|
24
24
|
spec.add_dependency 'hydra-file_characterization', '~> 0.3', '>= 0.3.3'
|
25
25
|
spec.add_dependency 'hydra-pcdm', '>= 0.9'
|
26
|
-
spec.add_dependency 'om', '~> 3.1'
|
27
26
|
|
28
27
|
spec.add_development_dependency 'bundler', '~> 1.7'
|
29
28
|
spec.add_development_dependency 'coveralls'
|
30
29
|
spec.add_development_dependency 'fcrepo_wrapper', '~> 0.1'
|
31
|
-
spec.add_development_dependency 'rake', '~>
|
30
|
+
spec.add_development_dependency 'rake', '~> 12.3'
|
32
31
|
spec.add_development_dependency 'rspec'
|
33
32
|
spec.add_development_dependency 'rspec-rails', '~> 3.1'
|
34
|
-
spec.add_development_dependency 'solr_wrapper', '~> 0
|
33
|
+
spec.add_development_dependency 'solr_wrapper', '~> 2.0'
|
35
34
|
spec.add_development_dependency 'sqlite3'
|
36
35
|
end
|
@@ -1,175 +1,351 @@
|
|
1
|
-
require 'om'
|
2
|
-
|
3
1
|
module Hydra::Works::Characterization
|
4
2
|
class FitsDocument
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
3
|
+
attr_accessor :ng_xml
|
4
|
+
|
5
|
+
PROXIED_TERMS = %i(
|
6
|
+
fits_version format_label file_mime_type exif_tool_version file_size
|
7
|
+
date_modified filename original_checksum date_created rights_basis
|
8
|
+
copyright_basis copyright_note well_formed valid filestatus_message
|
9
|
+
file_title file_author page_count file_language word_count
|
10
|
+
character_count paragraph_count line_count table_count graphics_count
|
11
|
+
byte_order compression width video_width video_track_width height
|
12
|
+
video_height video_track_height color_space profile_name profile_version
|
13
|
+
orientation color_map image_producer capture_device scanning_software
|
14
|
+
exif_version gps_timestamp latitude longitude character_set markup_basis
|
15
|
+
markup_language audio_duration video_duration bit_depth audio_sample_rate
|
16
|
+
video_sample_rate video_audio_sample_rate channels data_format offset
|
17
|
+
frame_rate audio_bit_rate video_bit_rate track_frame_rate aspect_ratio
|
18
|
+
).freeze
|
19
|
+
|
20
|
+
def proxied_term_hash
|
21
|
+
PROXIED_TERMS.map { |t| [t, send(t)] }.to_h
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.terminology
|
25
|
+
struct = Struct.new(:proxied_term).new
|
26
|
+
terminology = Struct.new(:terms)
|
27
|
+
terminology.new(PROXIED_TERMS.map { |t| [t, struct] }.to_h)
|
28
|
+
end
|
29
|
+
|
30
|
+
# t.fits_version(proxy: [:fits, :fits_v])
|
31
|
+
def fits_version
|
32
|
+
ng_xml.css("fits").map { |n| n['version'].text }
|
33
|
+
end
|
34
|
+
|
35
|
+
# t.format_label(proxy: [:identification, :identity, :format_label])
|
36
|
+
def format_label
|
37
|
+
ng_xml.css("fits > identification > identity").map { |n| n['format'] }
|
38
|
+
end
|
39
|
+
|
40
|
+
# Can't use .mime_type because it's already defined for this document so method missing won't work.
|
41
|
+
# t.file_mime_type(proxy: [:identification, :identity, :mime_type])
|
42
|
+
def file_mime_type
|
43
|
+
# Sometimes, FITS reports the mimetype attribute as a comma-separated string.
|
44
|
+
# All terms are arrays and, in this case, there is only one element, so scan the first.
|
45
|
+
ng_xml.css("fits > identification > identity").map { |n| n['mimetype'].split(',').first }
|
46
|
+
end
|
47
|
+
|
48
|
+
# t.exif_tool_version(proxy: [:identification, :identity, :tool, :exif_tool_version])
|
49
|
+
def exif_tool_version
|
50
|
+
ng_xml.css("fits > identification > identity > tool[toolname='Exiftool']").map { |n| n['toolversion'] }
|
51
|
+
end
|
52
|
+
|
53
|
+
# t.file_size(proxy: [:fileinfo, :file_size])
|
54
|
+
def file_size
|
55
|
+
ng_xml.css("fits > fileinfo > size").map(&:text)
|
56
|
+
end
|
57
|
+
|
58
|
+
# t.date_modified(proxy: [:fileinfo, :last_modified])
|
59
|
+
def date_modified
|
60
|
+
ng_xml.css("fits > fileinfo > lastmodified[toolname='Exiftool']").map(&:text)
|
61
|
+
end
|
62
|
+
|
63
|
+
# t.filename(proxy: [:fileinfo, :filename])
|
64
|
+
def filename
|
65
|
+
ng_xml.css("fits > fileinfo > filename").map(&:text)
|
66
|
+
end
|
67
|
+
|
68
|
+
# t.original_checksum(proxy: [:fileinfo, :original_checksum])
|
69
|
+
def original_checksum
|
70
|
+
ng_xml.css("fits > fileinfo > md5checksum").map(&:text)
|
71
|
+
end
|
72
|
+
|
73
|
+
# t.date_created(proxy: [:fileinfo, :date_created])
|
74
|
+
def date_created
|
75
|
+
ng_xml.css("fits > fileinfo > created[toolname='Exiftool']").map(&:text)
|
76
|
+
end
|
77
|
+
|
78
|
+
# t.rights_basis(proxy: [:fileinfo, :rights_basis])
|
79
|
+
def rights_basis
|
80
|
+
ng_xml.css("fits > fileinfo > rightsBasis").map(&:text)
|
81
|
+
end
|
82
|
+
|
83
|
+
# t.copyright_basis(proxy: [:fileinfo, :copyright_basis])
|
84
|
+
def copyright_basis
|
85
|
+
ng_xml.css("fits > fileinfo > copyrightBasis").map(&:text)
|
86
|
+
end
|
87
|
+
|
88
|
+
# t.copyright_basis(proxy: [:fileinfo, :copyright_note])
|
89
|
+
def copyright_note
|
90
|
+
ng_xml.css("fits > fileinfo > copyrightNote").map(&:text)
|
91
|
+
end
|
92
|
+
|
93
|
+
# t.well_formed(proxy: [:filestatus, :well_formed])
|
94
|
+
def well_formed
|
95
|
+
ng_xml.css("fits > filestatus > well-formed").map(&:text)
|
96
|
+
end
|
97
|
+
|
98
|
+
# t.valid(proxy: [:filestatus, :valid])
|
99
|
+
def valid
|
100
|
+
ng_xml.css("fits > filestatus > valid").map(&:text)
|
101
|
+
end
|
102
|
+
|
103
|
+
# t.filestatus_message(proxy: [:filestatus, :status_message])
|
104
|
+
def filestatus_message
|
105
|
+
ng_xml.css("fits > filestatus > message").map(&:text)
|
106
|
+
end
|
107
|
+
|
108
|
+
# t.file_title(proxy: [:metadata, :document, :file_title])
|
109
|
+
def file_title
|
110
|
+
ng_xml.css("fits > metadata > document > title").map(&:text)
|
111
|
+
end
|
112
|
+
|
113
|
+
# t.file_author(proxy: [:metadata, :document, :file_author])
|
114
|
+
def file_author
|
115
|
+
ng_xml.css("fits > metadata > document > author").map(&:text)
|
116
|
+
end
|
117
|
+
|
118
|
+
# t.file_language(proxy: [:metadata, :document, :file_language])
|
119
|
+
def file_language
|
120
|
+
ng_xml.css("fits > metadata > document > language").map(&:text)
|
121
|
+
end
|
122
|
+
|
123
|
+
# t.page_count(proxy: [:metadata, :document, :page_count])
|
124
|
+
def page_count
|
125
|
+
ng_xml.css("fits > metadata > document > pageCount").map(&:text)
|
126
|
+
end
|
127
|
+
|
128
|
+
# t.word_count(proxy: [:metadata, :document, :word_count])
|
129
|
+
def word_count
|
130
|
+
ng_xml.css("fits > metadata > document > wordCount").map(&:text)
|
131
|
+
end
|
132
|
+
|
133
|
+
# t.character_count(proxy: [:metadata, :document, :character_count])
|
134
|
+
def character_count
|
135
|
+
ng_xml.css("fits > metadata > document > characterCount").map(&:text)
|
136
|
+
end
|
137
|
+
|
138
|
+
# t.paragraph_count(proxy: [:metadata, :document, :paragraph_count])
|
139
|
+
def paragraph_count
|
140
|
+
ng_xml.css("fits > metadata > document > paragraphCount").map(&:text)
|
141
|
+
end
|
142
|
+
|
143
|
+
# t.line_count(proxy: [:metadata, :document, :line_count])
|
144
|
+
def line_count
|
145
|
+
ng_xml.css("fits > metadata > document > lineCount").map(&:text)
|
146
|
+
end
|
147
|
+
|
148
|
+
# t.table_count(proxy: [:metadata, :document, :table_count])
|
149
|
+
def table_count
|
150
|
+
ng_xml.css("fits > metadata > document > tableCount").map(&:text)
|
151
|
+
end
|
152
|
+
|
153
|
+
# t.graphics_count(proxy: [:metadata, :document, :graphics_count])
|
154
|
+
def graphics_count
|
155
|
+
ng_xml.css("fits > metadata > document > graphicsCount").map(&:text)
|
156
|
+
end
|
157
|
+
|
158
|
+
# t.byte_order(proxy: [:metadata, :image, :byte_order])
|
159
|
+
def byte_order
|
160
|
+
ng_xml.css("fits > metadata > image > byteOrder").map(&:text)
|
161
|
+
end
|
162
|
+
|
163
|
+
# t.compression(proxy: [:metadata, :image, :compression])
|
164
|
+
def compression
|
165
|
+
ng_xml.css("fits > metadata > image > compressionScheme").map(&:text)
|
166
|
+
end
|
167
|
+
|
168
|
+
# t.width(proxy: [:metadata, :image, :width])
|
169
|
+
def width
|
170
|
+
ng_xml.css("fits > metadata > image > imageWidth").map(&:text)
|
171
|
+
end
|
172
|
+
|
173
|
+
# t.height(proxy: [:metadata, :image, :height])
|
174
|
+
def height
|
175
|
+
ng_xml.css("fits > metadata > image > imageHeight").map(&:text)
|
176
|
+
end
|
177
|
+
|
178
|
+
# t.video_width(proxy: [:metadata, :video, :width])
|
179
|
+
def video_width
|
180
|
+
ng_xml.css("fits > metadata > video > imageWidth").map(&:text)
|
181
|
+
end
|
182
|
+
|
183
|
+
# t.video_height(proxy: [:metadata, :video, :height])
|
184
|
+
def video_height
|
185
|
+
ng_xml.css("fits > metadata > video > imageHeight").map(&:text)
|
186
|
+
end
|
187
|
+
|
188
|
+
# for fits 1
|
189
|
+
# t.video_track_width(proxy: [:metadata, :video, :track, :width])
|
190
|
+
def video_track_width
|
191
|
+
ng_xml.css("fits > metadata > video > track[type='video'] > width").map(&:text)
|
192
|
+
end
|
193
|
+
|
194
|
+
# for fits 1
|
195
|
+
# t.video_track_height(proxy: [:metadata, :video, :track, :height])
|
196
|
+
def video_track_height
|
197
|
+
ng_xml.css("fits > metadata > video > track[type='video'] > height").map(&:text)
|
198
|
+
end
|
199
|
+
|
200
|
+
# t.color_space(proxy: [:metadata, :image, :color_space])
|
201
|
+
def color_space
|
202
|
+
ng_xml.css("fits > metadata > image > colorSpace").map(&:text)
|
203
|
+
end
|
204
|
+
|
205
|
+
# t.profile_name(proxy: [:metadata, :image, :profile_name])
|
206
|
+
def profile_name
|
207
|
+
ng_xml.css("fits > metadata > image > iccProfileName").map(&:text)
|
208
|
+
end
|
209
|
+
|
210
|
+
# t.profile_version(proxy: [:metadata, :image, :profile_version])
|
211
|
+
def profile_version
|
212
|
+
ng_xml.css("fits > metadata > image > iccProfileVersion").map(&:text)
|
213
|
+
end
|
214
|
+
|
215
|
+
# t.orientation(proxy: [:metadata, :image, :orientation])
|
216
|
+
def orientation
|
217
|
+
ng_xml.css("fits > metadata > image > orientation").map(&:text)
|
218
|
+
end
|
219
|
+
|
220
|
+
# t.color_map(proxy: [:metadata, :image, :color_map])
|
221
|
+
def color_map
|
222
|
+
ng_xml.css("fits > metadata > image > colorMap").map(&:text)
|
223
|
+
end
|
224
|
+
|
225
|
+
# t.image_producer(proxy: [:metadata, :image, :image_producer])
|
226
|
+
def image_producer
|
227
|
+
ng_xml.css("fits > metadata > image > imageProducer").map(&:text)
|
228
|
+
end
|
229
|
+
|
230
|
+
# t.capture_device(proxy: [:metadata, :image, :capture_device])
|
231
|
+
def capture_device
|
232
|
+
ng_xml.css("fits > metadata > image > captureDevice").map(&:text)
|
233
|
+
end
|
234
|
+
|
235
|
+
# t.scanning_software(proxy: [:metadata, :image, :scanning_software])
|
236
|
+
def scanning_software
|
237
|
+
ng_xml.css("fits > metadata > image > scanningSoftwareName").map(&:text)
|
238
|
+
end
|
239
|
+
|
240
|
+
# t.exif_version(proxy: [:metadata, :image, :exif_version])
|
241
|
+
def exif_version
|
242
|
+
ng_xml.css("fits > metadata > image > exifVersion[toolname='Exiftool']").map(&:text)
|
243
|
+
end
|
244
|
+
|
245
|
+
# t.gps_timestamp(proxy: [:metadata, :image, :gps_timestamp])
|
246
|
+
def gps_timestamp
|
247
|
+
ng_xml.css("fits > metadata > image > gpsTimeStamp").map(&:text)
|
248
|
+
end
|
249
|
+
|
250
|
+
# t.latitude(proxy: [:metadata, :image, :latitude])
|
251
|
+
def latitude
|
252
|
+
ng_xml.css("fits > metadata > image > gpsDestLatitude").map(&:text)
|
253
|
+
end
|
254
|
+
|
255
|
+
# t.longitude(proxy: [:metadata, :image, :longitude])
|
256
|
+
def longitude
|
257
|
+
ng_xml.css("fits > metadata > image > gpsDestLongitude").map(&:text)
|
258
|
+
end
|
259
|
+
|
260
|
+
# t.character_set(proxy: [:metadata, :text, :character_set])
|
261
|
+
def character_set
|
262
|
+
ng_xml.css("fits > metadata > text > charset").map(&:text)
|
263
|
+
end
|
264
|
+
|
265
|
+
# t.markup_basis(proxy: [:metadata, :text, :markup_basis])
|
266
|
+
def markup_basis
|
267
|
+
ng_xml.css("fits > metadata > text > markupBasis").map(&:text)
|
268
|
+
end
|
269
|
+
|
270
|
+
# t.markup_language(proxy: [:metadata, :text, :markup_language])
|
271
|
+
def markup_language
|
272
|
+
ng_xml.css("fits > metadata > text > markupLanguage").map(&:text)
|
273
|
+
end
|
274
|
+
|
275
|
+
# t.audio_duration(proxy: [:metadata, :audio, :duration])
|
276
|
+
def audio_duration
|
277
|
+
ng_xml.css("fits > metadata > audio > duration").map(&:text)
|
278
|
+
end
|
279
|
+
|
280
|
+
# t.bit_depth(proxy: [:metadata, :audio, :bit_depth])
|
281
|
+
def bit_depth
|
282
|
+
ng_xml.css("fits > metadata > audio > bitDepth").map(&:text)
|
283
|
+
end
|
284
|
+
|
285
|
+
# t.audio_sample_rate(proxy: [:metadata, :audio, :sample_rate])
|
286
|
+
def audio_sample_rate
|
287
|
+
ng_xml.css("fits > metadata > audio > sampleRate").map(&:text)
|
288
|
+
end
|
289
|
+
|
290
|
+
# t.channels(proxy: [:metadata, :audio, :channels])
|
291
|
+
def channels
|
292
|
+
ng_xml.css("fits > metadata > audio > channels").map(&:text)
|
293
|
+
end
|
294
|
+
|
295
|
+
# t.data_format(proxy: [:metadata, :audio, :data_format])
|
296
|
+
def data_format
|
297
|
+
ng_xml.css("fits > metadata > audio > dataFormatType").map(&:text)
|
298
|
+
end
|
299
|
+
|
300
|
+
# t.offset(proxy: [:metadata, :audio, :offset])
|
301
|
+
def offset
|
302
|
+
ng_xml.css("fits > metadata > audio > offset").map(&:text)
|
303
|
+
end
|
304
|
+
|
305
|
+
# t.audio_bit_rate(proxy: [:metadata, :audio, :bit_rate])
|
306
|
+
def audio_bit_rate
|
307
|
+
ng_xml.css("fits > metadata > audio > bitRate").map(&:text)
|
308
|
+
end
|
309
|
+
|
310
|
+
# t.video_duration(proxy: [:metadata, :video, :duration])
|
311
|
+
def video_duration
|
312
|
+
ng_xml.css("fits > metadata > video > duration").map(&:text)
|
313
|
+
end
|
314
|
+
|
315
|
+
# t.video_sample_rate(proxy: [:metadata, :video, :sample_rate])
|
316
|
+
def video_sample_rate
|
317
|
+
ng_xml.css("fits > metadata > video > sampleRate").map(&:text)
|
318
|
+
end
|
319
|
+
|
320
|
+
# t.video_audio_sample_rate(proxy: [:metadata, :video, :audio_sample_rate])
|
321
|
+
def video_audio_sample_rate
|
322
|
+
ng_xml.css("fits > metadata > video > audioSampleRate").map(&:text)
|
323
|
+
end
|
324
|
+
|
325
|
+
# t.frame_rate(proxy: [:metadata, :video, :frame_rate])
|
326
|
+
def frame_rate
|
327
|
+
ng_xml.css("fits > metadata > video > frameRate").map(&:text)
|
328
|
+
end
|
329
|
+
|
330
|
+
# t.video_bit_rate(proxy: [:metadata, :video, :bit_rate])
|
331
|
+
def video_bit_rate
|
332
|
+
ng_xml.css("fits > metadata > video > bitRate").map(&:text)
|
333
|
+
end
|
334
|
+
|
335
|
+
# t.track_frame_rate(proxy: [:metadata, :video, :track, :frame_rate])
|
336
|
+
def track_frame_rate
|
337
|
+
ng_xml.css("fits > metadata > video > track[type='video'] > frameRate").map(&:text)
|
338
|
+
end
|
339
|
+
|
340
|
+
# t.aspect_ratio(proxy: [:metadata, :video, :track, :aspect_ratio])
|
341
|
+
def aspect_ratio
|
342
|
+
ng_xml.css("fits > metadata > video > track[type='video'] > aspectRatio").map(&:text)
|
161
343
|
end
|
162
344
|
|
163
345
|
# Cleanup phase; ugly name to avoid collisions.
|
164
346
|
# The send construct here is required to fix up values because the setters
|
165
347
|
# are not defined, but rather applied with method_missing.
|
166
348
|
def __cleanup__
|
167
|
-
# Sometimes, FITS reports the mimetype attribute as a comma-separated string.
|
168
|
-
# All terms are arrays and, in this case, there is only one element, so scan the first.
|
169
|
-
if file_mime_type.present? && file_mime_type.first.include?(',')
|
170
|
-
send("file_mime_type=", [file_mime_type.first.split(',').first])
|
171
|
-
end
|
172
|
-
|
173
349
|
# Add any other scrubbers here; don't return any particular value
|
174
350
|
nil
|
175
351
|
end
|