Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
e91481cf
Commit
e91481cf
authored
Dec 18, 2017
by
Mushtaq Ali
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add language sorting,
Transcript title video file format extesion removed dynamically, Code refactor
parent
adbb953c
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
63 additions
and
11 deletions
+63
-11
cms/djangoapps/contentstore/views/videos.py
+19
-1
cms/static/js/factories/videos_index.js
+4
-2
cms/static/js/views/previous_video_upload.js
+2
-1
cms/static/js/views/previous_video_upload_list.js
+2
-1
cms/static/js/views/video_transcripts.js
+34
-4
cms/templates/js/video-transcripts.underscore
+2
-2
No files found.
cms/djangoapps/contentstore/views/videos.py
View file @
e91481cf
...
@@ -575,7 +575,25 @@ def _get_index_videos(course):
...
@@ -575,7 +575,25 @@ def _get_index_videos(course):
]
]
def
get_all_transcript_languages
():
def
get_all_transcript_languages
():
return
get_3rd_party_transcription_plans
()[
TranscriptProvider
.
THREE_PLAY_MEDIA
][
'languages'
]
"""
Returns all possible languages for transcript.
"""
transcription_plans
=
get_3rd_party_transcription_plans
()
cielo_fidelity
=
transcription_plans
[
TranscriptProvider
.
CIELO24
][
'fidelity'
]
# Get third party transcription languages.
third_party_transcription_languages
=
transcription_plans
[
TranscriptProvider
.
THREE_PLAY_MEDIA
][
'languages'
]
third_party_transcription_languages
=
dict
(
third_party_transcription_languages
,
**
cielo_fidelity
[
'MECHANICAL'
][
'languages'
])
third_party_transcription_languages
=
dict
(
third_party_transcription_languages
,
**
cielo_fidelity
[
'PREMIUM'
][
'languages'
])
third_party_transcription_languages
=
dict
(
third_party_transcription_languages
,
**
cielo_fidelity
[
'PROFESSIONAL'
][
'languages'
])
# Get all settings languages dict.
all_languages
=
{}
for
language
in
settings
.
ALL_LANGUAGES
:
all_languages
.
update
({
language
[
0
]:
language
[
1
]})
# Return combined settings and 3rd party transcript languages.
return
dict
(
all_languages
,
**
third_party_transcription_languages
)
def
videos_index_html
(
course
):
def
videos_index_html
(
course
):
"""
"""
...
...
cms/static/js/factories/videos_index.js
View file @
e91481cf
...
@@ -53,7 +53,8 @@ define([
...
@@ -53,7 +53,8 @@ define([
collection
:
updatedCollection
,
collection
:
updatedCollection
,
encodingsDownloadUrl
:
encodingsDownloadUrl
,
encodingsDownloadUrl
:
encodingsDownloadUrl
,
videoImageSettings
:
videoImageSettings
,
videoImageSettings
:
videoImageSettings
,
transcriptAvailableLanguages
:
transcriptAvailableLanguages
transcriptAvailableLanguages
:
transcriptAvailableLanguages
,
videoSupportedFileFormats
:
videoSupportedFileFormats
});
});
$contentWrapper
.
find
(
'.wrapper-assets'
).
replaceWith
(
updatedView
.
render
().
$el
);
$contentWrapper
.
find
(
'.wrapper-assets'
).
replaceWith
(
updatedView
.
render
().
$el
);
});
});
...
@@ -66,7 +67,8 @@ define([
...
@@ -66,7 +67,8 @@ define([
collection
:
new
Backbone
.
Collection
(
previousUploads
),
collection
:
new
Backbone
.
Collection
(
previousUploads
),
encodingsDownloadUrl
:
encodingsDownloadUrl
,
encodingsDownloadUrl
:
encodingsDownloadUrl
,
videoImageSettings
:
videoImageSettings
,
videoImageSettings
:
videoImageSettings
,
transcriptAvailableLanguages
:
transcriptAvailableLanguages
transcriptAvailableLanguages
:
transcriptAvailableLanguages
,
videoSupportedFileFormats
:
videoSupportedFileFormats
});
});
$contentWrapper
.
append
(
activeView
.
render
().
$el
);
$contentWrapper
.
append
(
activeView
.
render
().
$el
);
$contentWrapper
.
append
(
previousView
.
render
().
$el
);
$contentWrapper
.
append
(
previousView
.
render
().
$el
);
...
...
cms/static/js/views/previous_video_upload.js
View file @
e91481cf
...
@@ -33,7 +33,8 @@ define(
...
@@ -33,7 +33,8 @@ define(
transcripts
:
this
.
model
.
get
(
'transcripts'
),
transcripts
:
this
.
model
.
get
(
'transcripts'
),
edxVideoID
:
this
.
model
.
get
(
'edx_video_id'
),
edxVideoID
:
this
.
model
.
get
(
'edx_video_id'
),
clientVideoID
:
this
.
model
.
get
(
'client_video_id'
),
clientVideoID
:
this
.
model
.
get
(
'client_video_id'
),
transcriptAvailableLanguages
:
this
.
options
.
transcriptAvailableLanguages
transcriptAvailableLanguages
:
options
.
transcriptAvailableLanguages
,
videoSupportedFileFormats
:
options
.
videoSupportedFileFormats
});
});
},
},
...
...
cms/static/js/views/previous_video_upload_list.js
View file @
e91481cf
...
@@ -17,7 +17,8 @@ define(
...
@@ -17,7 +17,8 @@ define(
videoHandlerUrl
:
options
.
videoHandlerUrl
,
videoHandlerUrl
:
options
.
videoHandlerUrl
,
videoImageSettings
:
options
.
videoImageSettings
,
videoImageSettings
:
options
.
videoImageSettings
,
model
:
model
,
model
:
model
,
transcriptAvailableLanguages
:
options
.
transcriptAvailableLanguages
transcriptAvailableLanguages
:
options
.
transcriptAvailableLanguages
,
videoSupportedFileFormats
:
options
.
videoSupportedFileFormats
});
});
});
});
},
},
...
...
cms/static/js/views/video_transcripts.js
View file @
e91481cf
...
@@ -19,14 +19,42 @@ define(
...
@@ -19,14 +19,42 @@ define(
this
.
edxVideoID
=
options
.
edxVideoID
;
this
.
edxVideoID
=
options
.
edxVideoID
;
this
.
clientVideoID
=
options
.
clientVideoID
;
this
.
clientVideoID
=
options
.
clientVideoID
;
this
.
transcriptAvailableLanguages
=
options
.
transcriptAvailableLanguages
;
this
.
transcriptAvailableLanguages
=
options
.
transcriptAvailableLanguages
;
this
.
videoSupportedFileFormats
=
options
.
videoSupportedFileFormats
;
this
.
template
=
HtmlUtils
.
template
(
videoTranscriptsTemplate
);
this
.
template
=
HtmlUtils
.
template
(
videoTranscriptsTemplate
);
},
},
/*
Sorts object by value and returns a sorted array.
*/
sortByValue
:
function
(
itemObject
)
{
var
sortedArray
=
[];
_
.
each
(
itemObject
,
function
(
value
,
key
)
{
// Push each JSON Object entry in array by [value, key]
sortedArray
.
push
([
value
,
key
]);
});
return
sortedArray
.
sort
();
},
/*
Returns transcript title.
*/
getTranscriptClientTitle
:
function
()
{
getTranscriptClientTitle
:
function
()
{
// TODO: Use supported video file types.
// Use a fixed length tranascript name.
return
this
.
clientVideoID
.
substring
(
0
,
20
).
replace
(
'.mp4'
,
''
);
var
clientTitle
=
this
.
clientVideoID
.
substring
(
0
,
20
);
// Remove video file extension for transcript title.
_
.
each
(
this
.
videoSupportedFileFormats
,
function
(
videoFormat
)
{
clientTitle
.
replace
(
videoFormat
,
''
);
});
return
clientTitle
;
},
},
/*
Toggles Show/Hide transcript button and transcripts container.
*/
toggleShowTranscripts
:
function
()
{
toggleShowTranscripts
:
function
()
{
var
$transcriptsWrapperEl
=
this
.
$el
.
find
(
'.show-video-transcripts-wrapper'
);
var
$transcriptsWrapperEl
=
this
.
$el
.
find
(
'.show-video-transcripts-wrapper'
);
...
@@ -53,15 +81,17 @@ define(
...
@@ -53,15 +81,17 @@ define(
this
.
$el
.
find
(
'.toggle-show-transcripts-icon'
).
removeClass
(
'fa-caret-right'
);
this
.
$el
.
find
(
'.toggle-show-transcripts-icon'
).
removeClass
(
'fa-caret-right'
);
this
.
$el
.
find
(
'.toggle-show-transcripts-icon'
).
addClass
(
'fa-caret-down'
);
this
.
$el
.
find
(
'.toggle-show-transcripts-icon'
).
addClass
(
'fa-caret-down'
);
}
}
},
},
/*
Renders transcripts view.
*/
render
:
function
()
{
render
:
function
()
{
HtmlUtils
.
setHtml
(
HtmlUtils
.
setHtml
(
this
.
$el
,
this
.
$el
,
this
.
template
({
this
.
template
({
transcripts
:
this
.
transcripts
,
transcripts
:
this
.
transcripts
,
transcriptAvailableLanguages
:
this
.
transcriptAvailableLanguages
,
transcriptAvailableLanguages
:
this
.
sortByValue
(
this
.
transcriptAvailableLanguages
)
,
edxVideoID
:
this
.
edxVideoID
,
edxVideoID
:
this
.
edxVideoID
,
// Slice last 4 letters so that video filetype is not attached
// Slice last 4 letters so that video filetype is not attached
// eg. eg. Harry-Potter.mp4 would give us eg. Harry-Potter
// eg. eg. Harry-Potter.mp4 would give us eg. Harry-Potter
...
...
cms/templates/js/video-transcripts.underscore
View file @
e91481cf
...
@@ -16,8 +16,8 @@
...
@@ -16,8 +16,8 @@
<strong><%- StringUtils.interpolate(gettext('{transcriptClientTitle}_{transcriptLanguageCode}.{fileExtension}'), {transcriptClientTitle: transcriptClientTitle, transcriptLanguageCode: transcriptLanguageCode, fileExtension: transcriptDownloadFileFormat}) %></strong>
<strong><%- StringUtils.interpolate(gettext('{transcriptClientTitle}_{transcriptLanguageCode}.{fileExtension}'), {transcriptClientTitle: transcriptClientTitle, transcriptLanguageCode: transcriptLanguageCode, fileExtension: transcriptDownloadFileFormat}) %></strong>
<select id='transcript-language-<%- transcriptLanguageCode %>' class='transcript-language-menu'>
<select id='transcript-language-<%- transcriptLanguageCode %>' class='transcript-language-menu'>
<option value=''>Select Language</option>
<option value=''>Select Language</option>
<% _.each(transcriptAvailableLanguages, function(
languageText, languageCod
e){ %>
<% _.each(transcriptAvailableLanguages, function(
availableLanguag
e){ %>
<option value='<%-
languageCode %>' <%- transcriptLanguageCode === languageCode ? 'selected': '' %>><%- languageText
%></option>
<option value='<%-
availableLanguage[1] %>' <%- transcriptLanguageCode === availableLanguage[1] ? 'selected': '' %>><%- availableLanguage[0]
%></option>
<% }) %>
<% }) %>
</select>
</select>
<div class='transcript-actions'>
<div class='transcript-actions'>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment