-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #393 from Minitex/captions-support
Provide captions support on A/V items
- Loading branch information
Showing
45 changed files
with
21,586 additions
and
1,285 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
# Not a real endpoint | ||
SLACK_NOTIFY_URL=https://hooks.slack.com/triggers/mdl-unit-test-endpoint | ||
KALTURA_SESSION= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
class TracksController < ApplicationController | ||
before_action :set_cors_headers | ||
|
||
def entry | ||
respond_to do |format| | ||
format.vtt do | ||
content = fetch_vtt_content | ||
head :not_found and return unless content.present? | ||
|
||
vtt_content = JSON.parse(content).dig(params[:entry_id]) | ||
head :not_found and return unless vtt_content.present? | ||
|
||
render plain: "WEBVTT\n\n#{vtt_content}", content_type: 'text/vtt' | ||
end | ||
end | ||
end | ||
|
||
private | ||
|
||
# TODO: remove | ||
def set_cors_headers | ||
headers['access-control-allow-origin'] = '*' | ||
headers['access-control-allow-methods'] = 'GET' | ||
headers['access-control-allow-headers'] = 'Accept, Accept-Language, Content-Type, Authorization' | ||
end | ||
|
||
def fetch_vtt_content | ||
client = Blacklight.default_index.connection | ||
response = client.get('select', params: { | ||
defType: 'edismax', | ||
fq: "id:\"#{RSolr.solr_escape(params[:id])}\"", | ||
fl: 'captions_ts', | ||
qt: 'search', | ||
rows: 1, | ||
q: '*:*', | ||
wt: 'json' | ||
}) | ||
docs = Array(response.dig('response', 'docs')) | ||
docs.first&.[]('captions_ts') | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.