Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

7.7.1 RC2 #5767

Merged
merged 2 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion app/models/iiif_canvas_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,11 @@ def manifest_attributes(quality, media_type)
def supplemental_attributes(file)
if file.is_a?(SupplementalFile)
label = file.tags.include?('machine_generated') ? file.label + ' (machine generated)' : file.label
format = file.file.content_type
format = if file.file.content_type == 'text/srt' && file.tags.include?('caption')
'text/vtt'
else
file.file.content_type
end
language = file.language || 'en'
filename = file.file.filename.to_s
else
Expand Down
10 changes: 10 additions & 0 deletions spec/models/iiif_canvas_presenter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,16 @@
expect(subject.any? { |content| content.body_id =~ /master_files\/#{master_file.id}\/captions/ }).to eq false
end

context 'srt captions' do
let(:srt_caption_file) { FactoryBot.create(:supplemental_file, :with_caption_srt_file, :with_caption_tag) }
let(:supplemental_files) { [supplemental_file, transcript_file, caption_file, srt_caption_file] }
it 'sets format to "text/vtt"' do
captions = subject.select { |s| s.body_id.include?('captions') }
expect(captions.none? { |content| content.format == 'text/srt' }).to eq true
expect(captions.all? { |content| content.format == 'text/vtt' }).to eq true
end
end

context 'legacy master file captions' do
let(:master_file) { FactoryBot.create(:master_file, :with_waveform, :with_captions, supplemental_files_json: supplemental_files_json, media_object: media_object, derivatives: [derivative]) }

Expand Down
Loading