Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-val
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-val
Commits
db6f587f
Commit
db6f587f
authored
Sep 11, 2017
by
Qubad786
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check transcript avaialbility
parent
84482730
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
0 deletions
+31
-0
edxval/api.py
+16
-0
edxval/tests/test_api.py
+15
-0
No files found.
edxval/api.py
View file @
db6f587f
...
...
@@ -142,6 +142,22 @@ def update_video_status(edx_video_id, status):
video
.
save
()
def
is_transcript_available
(
video_id
,
language_code
=
None
):
"""
Returns whether the transcripts are available for a video.
Arguments:
video_id: it can be an edx_video_id or an external_id extracted from external sources in a video component.
language_code: it will the language code of the requested transcript.
"""
filter_attrs
=
{
'video_id'
:
video_id
}
if
language_code
:
filter_attrs
[
'language_code'
]
=
language_code
transcript_set
=
VideoTranscript
.
objects
.
filter
(
**
filter_attrs
)
return
transcript_set
.
exists
()
def
get_video_transcript
(
video_id
,
language_code
):
"""
Get a video's transcript
...
...
edxval/tests/test_api.py
View file @
db6f587f
...
...
@@ -1512,6 +1512,21 @@ class TranscriptTest(TestCase):
)
@data
(
{
'video_id'
:
'super-soaker'
,
'language_code'
:
'en'
,
'expected_availability'
:
True
},
{
'video_id'
:
'super-soaker'
,
'language_code'
:
None
,
'expected_availability'
:
True
},
{
'video_id'
:
'super123'
,
'language_code'
:
'en'
,
'expected_availability'
:
False
},
{
'video_id'
:
'super-soaker'
,
'language_code'
:
'ro'
,
'expected_availability'
:
False
},
)
@unpack
def
test_is_transcript_available
(
self
,
video_id
,
language_code
,
expected_availability
):
"""
Verify that `is_transcript_available` api function works as expected.
"""
is_transcript_available
=
api
.
is_transcript_available
(
video_id
,
language_code
)
self
.
assertEqual
(
is_transcript_available
,
expected_availability
)
@unpack
@data
(
{
'video_id'
:
'super-soaker'
,
'language_code'
:
'en'
,
'result'
:
True
},
{
'video_id'
:
'super-soaker'
,
'language_code'
:
'ur'
,
'result'
:
False
},
{
'video_id'
:
'super123'
,
'language_code'
:
'en'
,
'result'
:
False
},
...
...
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