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
333842a3
Commit
333842a3
authored
Dec 18, 2017
by
Mushtaq Ali
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add the functionality behind feature flag
parent
ccf76b3b
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
49 additions
and
28 deletions
+49
-28
cms/djangoapps/contentstore/views/videos.py
+21
-14
cms/static/js/factories/videos_index.js
+4
-2
cms/static/js/views/previous_video_upload.js
+14
-8
cms/static/js/views/previous_video_upload_list.js
+5
-2
cms/templates/js/previous-video-upload-list.underscore
+2
-0
cms/templates/js/previous-video-upload.underscore
+2
-0
cms/templates/js/video-transcripts.underscore
+1
-2
No files found.
cms/djangoapps/contentstore/views/videos.py
View file @
333842a3
...
...
@@ -527,17 +527,19 @@ def _get_videos(course):
"""
Retrieves the list of videos from VAL corresponding to this course.
"""
is_video_transcript_enabled
=
VideoTranscriptEnabledFlag
.
feature_enabled
(
course
.
id
)
videos
=
list
(
get_videos_for_course
(
unicode
(
course
.
id
),
VideoSortField
.
created
,
SortDirection
.
desc
))
# convert VAL's status to studio's Video Upload feature status.
for
video
in
videos
:
video
[
"status"
]
=
convert_video_status
(
video
)
transcripts
=
{}
for
lang_code
in
get_available_transcript_languages
([
video
[
'edx_video_id'
]]):
transcripts
.
update
({
lang_code
:
get_all_transcript_languages
()[
lang_code
]})
if
is_video_transcript_enabled
:
transcripts
=
{}
for
lang_code
in
get_available_transcript_languages
([
video
[
'edx_video_id'
]]):
transcripts
.
update
({
lang_code
:
get_all_transcript_languages
(
is_video_transcript_enabled
)[
lang_code
]})
video
[
'transcripts'
]
=
transcripts
video
[
'transcripts'
]
=
transcripts
return
videos
...
...
@@ -554,7 +556,10 @@ def _get_index_videos(course):
Returns the information about each video upload required for the video list
"""
course_id
=
unicode
(
course
.
id
)
attrs
=
[
'edx_video_id'
,
'client_video_id'
,
'created'
,
'duration'
,
'status'
,
'courses'
,
'transcripts'
]
attrs
=
[
'edx_video_id'
,
'client_video_id'
,
'created'
,
'duration'
,
'status'
,
'courses'
]
if
VideoTranscriptEnabledFlag
.
feature_enabled
(
course
.
id
):
attrs
+=
[
'transcripts'
]
def
_get_values
(
video
):
"""
...
...
@@ -574,18 +579,20 @@ def _get_index_videos(course):
_get_values
(
video
)
for
video
in
_get_videos
(
course
)
]
def
get_all_transcript_languages
():
def
get_all_transcript_languages
(
is_video_transcript_enabled
=
False
):
"""
Returns all possible languages for transcript.
"""
transcription_plans
=
get_3rd_party_transcription_plans
()
cielo_fidelity
=
transcription_plans
[
TranscriptProvider
.
CIELO24
][
'fidelity'
]
third_party_transcription_languages
=
{}
if
is_video_transcript_enabled
:
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 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
=
{}
...
...
@@ -622,7 +629,7 @@ def videos_index_html(course):
'video_transcript_settings'
:
None
,
'active_transcript_preferences'
:
None
,
'transcript_credentials'
:
None
,
'transcript_available_languages'
:
get_all_transcript_languages
()
'transcript_available_languages'
:
get_all_transcript_languages
(
is_video_transcript_enabled
)
}
if
is_video_transcript_enabled
:
...
...
cms/static/js/factories/videos_index.js
View file @
333842a3
...
...
@@ -54,7 +54,8 @@ define([
encodingsDownloadUrl
:
encodingsDownloadUrl
,
videoImageSettings
:
videoImageSettings
,
transcriptAvailableLanguages
:
transcriptAvailableLanguages
,
videoSupportedFileFormats
:
videoSupportedFileFormats
videoSupportedFileFormats
:
videoSupportedFileFormats
,
isVideoTranscriptEnabled
:
isVideoTranscriptEnabled
});
$contentWrapper
.
find
(
'.wrapper-assets'
).
replaceWith
(
updatedView
.
render
().
$el
);
});
...
...
@@ -68,7 +69,8 @@ define([
encodingsDownloadUrl
:
encodingsDownloadUrl
,
videoImageSettings
:
videoImageSettings
,
transcriptAvailableLanguages
:
transcriptAvailableLanguages
,
videoSupportedFileFormats
:
videoSupportedFileFormats
videoSupportedFileFormats
:
videoSupportedFileFormats
,
isVideoTranscriptEnabled
:
isVideoTranscriptEnabled
});
$contentWrapper
.
append
(
activeView
.
render
().
$el
);
$contentWrapper
.
append
(
previousView
.
render
().
$el
);
...
...
cms/static/js/views/previous_video_upload.js
View file @
333842a3
...
...
@@ -20,6 +20,7 @@ define(
this
.
template
=
HtmlUtils
.
template
(
previousVideoUploadTemplate
);
this
.
videoHandlerUrl
=
options
.
videoHandlerUrl
;
this
.
videoImageUploadEnabled
=
options
.
videoImageSettings
.
video_image_upload_enabled
;
this
.
isVideoTranscriptEnabled
=
options
.
isVideoTranscriptEnabled
;
if
(
this
.
videoImageUploadEnabled
)
{
this
.
videoThumbnailView
=
new
VideoThumbnailView
({
...
...
@@ -29,18 +30,21 @@ define(
videoImageSettings
:
options
.
videoImageSettings
});
}
this
.
videoTranscriptsView
=
new
VideoTranscriptsView
({
transcripts
:
this
.
model
.
get
(
'transcripts'
),
edxVideoID
:
this
.
model
.
get
(
'edx_video_id'
),
clientVideoID
:
this
.
model
.
get
(
'client_video_id'
),
transcriptAvailableLanguages
:
options
.
transcriptAvailableLanguages
,
videoSupportedFileFormats
:
options
.
videoSupportedFileFormats
});
if
(
this
.
isVideoTranscriptEnabled
)
{
this
.
videoTranscriptsView
=
new
VideoTranscriptsView
({
transcripts
:
this
.
model
.
get
(
'transcripts'
),
edxVideoID
:
this
.
model
.
get
(
'edx_video_id'
),
clientVideoID
:
this
.
model
.
get
(
'client_video_id'
),
transcriptAvailableLanguages
:
options
.
transcriptAvailableLanguages
,
videoSupportedFileFormats
:
options
.
videoSupportedFileFormats
});
}
},
render
:
function
()
{
var
renderedAttributes
=
{
videoImageUploadEnabled
:
this
.
videoImageUploadEnabled
,
isVideoTranscriptEnabled
:
this
.
isVideoTranscriptEnabled
,
created
:
DateUtils
.
renderDate
(
this
.
model
.
get
(
'created'
)),
status
:
this
.
model
.
get
(
'status'
)
};
...
...
@@ -54,7 +58,9 @@ define(
if
(
this
.
videoImageUploadEnabled
)
{
this
.
videoThumbnailView
.
setElement
(
this
.
$
(
'.thumbnail-col'
)).
render
();
}
this
.
videoTranscriptsView
.
setElement
(
this
.
$
(
'.transcripts-col'
)).
render
();
if
(
this
.
isVideoTranscriptEnabled
)
{
this
.
videoTranscriptsView
.
setElement
(
this
.
$
(
'.transcripts-col'
)).
render
();
}
return
this
;
},
...
...
cms/static/js/views/previous_video_upload_list.js
View file @
333842a3
...
...
@@ -10,6 +10,7 @@ define(
this
.
template
=
this
.
loadTemplate
(
'previous-video-upload-list'
);
this
.
encodingsDownloadUrl
=
options
.
encodingsDownloadUrl
;
this
.
videoImageUploadEnabled
=
options
.
videoImageSettings
.
video_image_upload_enabled
;
this
.
isVideoTranscriptEnabled
=
options
.
isVideoTranscriptEnabled
;
this
.
itemViews
=
this
.
collection
.
map
(
function
(
model
)
{
return
new
PreviousVideoUploadView
({
videoImageUploadURL
:
options
.
videoImageUploadURL
,
...
...
@@ -18,7 +19,8 @@ define(
videoImageSettings
:
options
.
videoImageSettings
,
model
:
model
,
transcriptAvailableLanguages
:
options
.
transcriptAvailableLanguages
,
videoSupportedFileFormats
:
options
.
videoSupportedFileFormats
videoSupportedFileFormats
:
options
.
videoSupportedFileFormats
,
isVideoTranscriptEnabled
:
options
.
isVideoTranscriptEnabled
});
});
},
...
...
@@ -28,7 +30,8 @@ define(
$tabBody
;
$el
.
html
(
this
.
template
({
encodingsDownloadUrl
:
this
.
encodingsDownloadUrl
,
videoImageUploadEnabled
:
this
.
videoImageUploadEnabled
videoImageUploadEnabled
:
this
.
videoImageUploadEnabled
,
isVideoTranscriptEnabled
:
this
.
isVideoTranscriptEnabled
}));
$tabBody
=
$el
.
find
(
'.js-table-body'
);
_
.
each
(
this
.
itemViews
,
function
(
view
)
{
...
...
cms/templates/js/previous-video-upload-list.underscore
View file @
333842a3
...
...
@@ -14,7 +14,9 @@
<div class="video-head-col video-col name-col"><%- gettext("Name") %></div>
<div class="video-head-col video-col date-col"><%- gettext("Date Added") %></div>
<div class="video-head-col video-col video-id-col"><%- gettext("Video ID") %></div>
<% if (isVideoTranscriptEnabled) { %>
<div class="video-head-col video-col transcripts-col"><%- gettext("Transcripts") %></div>
<% } %>
<div class="video-head-col video-col status-col"><%- gettext("Status") %></div>
<div class="video-head-col video-col actions-col"><%- gettext("Action") %></div>
</div>
...
...
cms/templates/js/previous-video-upload.underscore
View file @
333842a3
...
...
@@ -5,7 +5,9 @@
<div class="video-col name-col"><%- client_video_id %></div>
<div class="video-col date-col"><%- created %></div>
<div class="video-col video-id-col"><%- edx_video_id %></div>
<% if (isVideoTranscriptEnabled) { %>
<div class="video-col transcripts-col"></div>
<% } %>
<div class="video-col status-col"><%- status %> </div>
<div class="video-col actions-col">
<ul class="actions-list">
...
...
cms/templates/js/video-transcripts.underscore
View file @
333842a3
...
...
@@ -35,4 +35,4 @@
</div>
</div>
<% }) %>
</div>
\ No newline at end of file
</div>
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