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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 85a73441a989a8a6103b8461445b0bd1cd2a5b89
4
- data.tar.gz: 46c6ea127d5b5ea125f6d467276856df7eaaf94b
2
+ SHA256:
3
+ metadata.gz: f17bd910e50c6baeda9000b13a4f625615be042df52f102206b051dcb32c6039
4
+ data.tar.gz: ec76af677423c06b7bfe68e297aef518a8cd43ba5b4fbcffef7c9a8e55fe5312
5
5
  SHA512:
6
- metadata.gz: 6f7afde9dfc6d577b7ccea96aa997d7cdf654a8001bfb280fa3631b346e4ac4e6c0b574e0f396dbd8403fe0975a0060e6a037df2ded391435288d6c9969061a3
7
- data.tar.gz: 15992b88bbf1f9a5f3a63b282ed3d37d700d1cdb5ea45e7a24b3e77e54c9c0d2b584b45cadf22c9e66c710914b8898133fdb98570694731353ae89889b3f1cc4
6
+ metadata.gz: 38064607b5073e2618072580e5f9b242666658fcd0d7415b819d2462b1f18fd1d20d350be64f10b268f88b8ea570b0055428d3e2932ddd8cb8b32c6cbf272944
7
+ data.tar.gz: 7a725c734c6bca2b25e62387f281013cc9dcaf55a8584cfa98318a5a74e6c644cbb75fefb53af81cc52a64e156aedd9bb9dc65b223c49fa73873706642a7d544
data/.rubocop.yml CHANGED
@@ -2,6 +2,7 @@ require: rubocop-rspec
2
2
  inherit_from: .rubocop_todo.yml
3
3
 
4
4
  AllCops:
5
+ TargetRubyVersion: 2.3
5
6
  DisplayCopNames: true
6
7
  Include:
7
8
  - '**/Rakefile'
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', '< 5.2'
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', '~> 10.0'
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.4'
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
- include OM::XML::Document
6
-
7
- set_terminology do |t|
8
- t.root(path: 'fits',
9
- xmlns: 'http://hul.harvard.edu/ois/xml/ns/fits/fits_output',
10
- schema: 'http://hul.harvard.edu/ois/xml/xsd/fits/fits_output.xsd')
11
- t.fits_v(path: { attribute: 'version' })
12
- t.identification do
13
- t.identity do
14
- t.format_label(path: { attribute: 'format' })
15
- t.mime_type(path: { attribute: 'mimetype' })
16
- t.tool(attributes: { toolname: "Exiftool" }) do
17
- t.exif_tool_version(path: { attribute: 'toolversion' })
18
- end
19
- end
20
- end
21
- t.fileinfo do
22
- t.file_size(path: 'size')
23
- t.last_modified(path: 'lastmodified', attributes: { toolname: "Exiftool" })
24
- t.filename(path: 'filename')
25
- t.original_checksum(path: 'md5checksum')
26
- t.date_created(path: 'created', attributes: { toolname: "Exiftool" })
27
- t.rights_basis(path: 'rightsBasis')
28
- t.copyright_basis(path: 'copyrightBasis')
29
- t.copyright_note(path: 'copyrightNote')
30
- end
31
- t.filestatus do
32
- t.well_formed(path: 'well-formed')
33
- t.valid(path: 'valid')
34
- t.status_message(path: 'message')
35
- end
36
- t.metadata do
37
- t.document do
38
- t.file_title(path: 'title')
39
- t.file_author(path: 'author')
40
- t.file_language(path: 'language')
41
- t.page_count(path: 'pageCount')
42
- t.word_count(path: 'wordCount')
43
- t.character_count(path: 'characterCount')
44
- t.paragraph_count(path: 'paragraphCount')
45
- t.line_count(path: 'lineCount')
46
- t.table_count(path: 'tableCount')
47
- t.graphics_count(path: 'graphicsCount')
48
- end
49
- t.image do
50
- t.byte_order(path: 'byteOrder')
51
- t.compression(path: 'compressionScheme')
52
- t.width(path: 'imageWidth')
53
- t.height(path: 'imageHeight')
54
- t.color_space(path: 'colorSpace')
55
- t.profile_name(path: 'iccProfileName')
56
- t.profile_version(path: 'iccProfileVersion')
57
- t.orientation(path: 'orientation')
58
- t.color_map(path: 'colorMap')
59
- t.image_producer(path: 'imageProducer')
60
- t.capture_device(path: 'captureDevice')
61
- t.scanning_software(path: 'scanningSoftwareName')
62
- t.exif_version(path: 'exifVersion', attributes: { toolname: "Exiftool" })
63
- t.gps_timestamp(path: 'gpsTimeStamp')
64
- t.latitude(path: 'gpsDestLatitude')
65
- t.longitude(path: 'gpsDestLongitude')
66
- end
67
- t.text do
68
- t.character_set(path: 'charset')
69
- t.markup_basis(path: 'markupBasis')
70
- t.markup_language(path: 'markupLanguage')
71
- end
72
- t.audio do
73
- t.duration(path: 'duration')
74
- t.bit_depth(path: 'bitDepth')
75
- t.bit_rate(path: 'bitRate')
76
- t.sample_rate(path: 'sampleRate')
77
- t.channels(path: 'channels')
78
- t.data_format(path: 'dataFormatType')
79
- t.offset(path: 'offset')
80
- end
81
- t.video do
82
- t.width(path: 'imageWidth') # for fits_0.8.5
83
- t.height(path: 'imageHeight') # for fits_0.8.5
84
- t.duration(path: 'duration')
85
- t.bit_rate(path: 'bitRate') # for fits_1.2.0
86
- t.sample_rate(path: 'sampleRate') # for fits_0.8.5
87
- t.audio_sample_rate(path: 'audioSampleRate') # for fits_0.8.5
88
- t.frame_rate(path: 'frameRate') # for fits_0.8.5
89
- t.track(path: 'track', attributes: { type: 'video' }) do # for fits_1.2.0
90
- t.width(path: 'width')
91
- t.height(path: 'height')
92
- t.aspect_ratio(path: 'aspectRatio')
93
- t.frame_rate(path: 'frameRate')
94
- end
95
- end
96
- end
97
- # fits_version needs a different name than it's target node since they're at the same level
98
- t.fits_version(proxy: [:fits, :fits_v])
99
- t.format_label(proxy: [:identification, :identity, :format_label])
100
- # Can't use .mime_type because it's already defined for this dcoument so method missing won't work.
101
- t.file_mime_type(proxy: [:identification, :identity, :mime_type])
102
- t.exif_tool_version(proxy: [:identification, :identity, :tool, :exif_tool_version])
103
- t.file_size(proxy: [:fileinfo, :file_size])
104
- t.date_modified(proxy: [:fileinfo, :last_modified])
105
- t.filename(proxy: [:fileinfo, :filename])
106
- t.original_checksum(proxy: [:fileinfo, :original_checksum])
107
- t.date_created(proxy: [:fileinfo, :date_created])
108
- t.rights_basis(proxy: [:fileinfo, :rights_basis])
109
- t.copyright_basis(proxy: [:fileinfo, :copyright_basis])
110
- t.copyright_note(proxy: [:fileinfo, :copyright_note])
111
- t.well_formed(proxy: [:filestatus, :well_formed])
112
- t.valid(proxy: [:filestatus, :valid])
113
- t.filestatus_message(proxy: [:filestatus, :status_message])
114
- t.file_title(proxy: [:metadata, :document, :file_title])
115
- t.file_author(proxy: [:metadata, :document, :file_author])
116
- t.page_count(proxy: [:metadata, :document, :page_count])
117
- t.file_language(proxy: [:metadata, :document, :file_language])
118
- t.word_count(proxy: [:metadata, :document, :word_count])
119
- t.character_count(proxy: [:metadata, :document, :character_count])
120
- t.paragraph_count(proxy: [:metadata, :document, :paragraph_count])
121
- t.line_count(proxy: [:metadata, :document, :line_count])
122
- t.table_count(proxy: [:metadata, :document, :table_count])
123
- t.graphics_count(proxy: [:metadata, :document, :graphics_count])
124
- t.byte_order(proxy: [:metadata, :image, :byte_order])
125
- t.compression(proxy: [:metadata, :image, :compression])
126
- t.width(proxy: [:metadata, :image, :width])
127
- t.video_width(proxy: [:metadata, :video, :width])
128
- t.video_track_width(proxy: [:metadata, :video, :track, :width])
129
- t.height(proxy: [:metadata, :image, :height])
130
- t.video_height(proxy: [:metadata, :video, :height])
131
- t.video_track_height(proxy: [:metadata, :video, :track, :height])
132
- t.color_space(proxy: [:metadata, :image, :color_space])
133
- t.profile_name(proxy: [:metadata, :image, :profile_name])
134
- t.profile_version(proxy: [:metadata, :image, :profile_version])
135
- t.orientation(proxy: [:metadata, :image, :orientation])
136
- t.color_map(proxy: [:metadata, :image, :color_map])
137
- t.image_producer(proxy: [:metadata, :image, :image_producer])
138
- t.capture_device(proxy: [:metadata, :image, :capture_device])
139
- t.scanning_software(proxy: [:metadata, :image, :scanning_software])
140
- t.exif_version(proxy: [:metadata, :image, :exif_version])
141
- t.gps_timestamp(proxy: [:metadata, :image, :gps_timestamp])
142
- t.latitude(proxy: [:metadata, :image, :latitude])
143
- t.longitude(proxy: [:metadata, :image, :longitude])
144
- t.character_set(proxy: [:metadata, :text, :character_set])
145
- t.markup_basis(proxy: [:metadata, :text, :markup_basis])
146
- t.markup_language(proxy: [:metadata, :text, :markup_language])
147
- t.audio_duration(proxy: [:metadata, :audio, :duration])
148
- t.video_duration(proxy: [:metadata, :video, :duration])
149
- t.bit_depth(proxy: [:metadata, :audio, :bit_depth])
150
- t.audio_sample_rate(proxy: [:metadata, :audio, :sample_rate])
151
- t.video_sample_rate(proxy: [:metadata, :video, :sample_rate])
152
- t.video_audio_sample_rate(proxy: [:metadata, :video, :audio_sample_rate])
153
- t.channels(proxy: [:metadata, :audio, :channels])
154
- t.data_format(proxy: [:metadata, :audio, :data_format])
155
- t.offset(proxy: [:metadata, :audio, :offset])
156
- t.frame_rate(proxy: [:metadata, :video, :frame_rate])
157
- t.audio_bit_rate(proxy: [:metadata, :audio, :bit_rate])
158
- t.video_bit_rate(proxy: [:metadata, :video, :bit_rate])
159
- t.track_frame_rate(proxy: [:metadata, :video, :track, :frame_rate])
160
- t.aspect_ratio(proxy: [:metadata, :video, :track, :aspect_ratio])
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