Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-video-pipeline
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-video-pipeline
Commits
ca2b84b0
Commit
ca2b84b0
authored
Oct 05, 2017
by
Qubad786
Committed by
muzaffaryousaf
Oct 16, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add options={iwp_name: FINAL} to avoid multiple Cielo24 callbacks.
parent
d5448f7c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
12 deletions
+33
-12
VEDA_OS01/tests/test_transcripts.py
+18
-7
VEDA_OS01/transcripts.py
+10
-4
control/tests/test_deliver_cielo.py
+2
-0
control/veda_deliver_cielo.py
+3
-1
No files found.
VEDA_OS01/tests/test_transcripts.py
View file @
ca2b84b0
...
...
@@ -43,7 +43,7 @@ TRANSCRIPT_PREFERENCES = {
'api_secret'
:
'i_am_secret'
,
}
REQUEST_PARAMS
=
{
'job_id'
:
100
,
'lang_code'
:
'en'
,
'org'
:
'MAx'
,
'video_id'
:
'111'
}
REQUEST_PARAMS
=
{
'job_id'
:
100
,
'
iwp_name'
:
'FINAL'
,
'
lang_code'
:
'en'
,
'org'
:
'MAx'
,
'video_id'
:
'111'
}
TRANSCRIPT_SRT_DATA
=
"""
1
...
...
@@ -154,15 +154,15 @@ class Cielo24TranscriptTests(APITestCase):
"""
response
=
self
.
client
.
get
(
url
or
self
.
url
,
{
'job_id'
:
3
,
'lang_code'
:
'ar'
,
'org'
:
'edx'
,
'video_id'
:
12345
}
{
'job_id'
:
3
,
'
iwp_name'
:
'FINAL'
,
'
lang_code'
:
'ar'
,
'org'
:
'edx'
,
'video_id'
:
12345
}
)
self
.
assertEqual
(
response
.
status_code
,
status_code
)
@data
(
({},
[
'job_id'
,
'lang_code'
,
'org'
,
'video_id'
]),
({
'job_id'
:
1
},
[
'lang_code'
,
'org'
,
'video_id'
]),
({
'job_id'
:
2
,
'lang_code'
:
'en'
},
[
'org'
,
'video_id'
]),
({
'job_id'
:
3
,
'lang_code'
:
'ar'
,
'org'
:
'edx'
},
[
'video_id'
]),
({},
[
'job_id'
,
'
iwp_name'
,
'
lang_code'
,
'org'
,
'video_id'
]),
({
'job_id'
:
1
},
[
'
iwp_name'
,
'
lang_code'
,
'org'
,
'video_id'
]),
({
'job_id'
:
2
,
'lang_code'
:
'en'
},
[
'
iwp_name'
,
'
org'
,
'video_id'
]),
({
'job_id'
:
3
,
'lang_code'
:
'ar'
,
'org'
:
'edx'
},
[
'
iwp_name'
,
'
video_id'
]),
)
@unpack
@patch
(
'VEDA_OS01.transcripts.LOGGER'
)
...
...
@@ -195,9 +195,10 @@ class Cielo24TranscriptTests(APITestCase):
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_200_OK
)
@patch
(
'VEDA_OS01.transcripts.VALAPICall._AUTH'
,
PropertyMock
(
return_value
=
lambda
:
CONFIG_DATA
))
@patch
(
'VEDA_OS01.transcripts.LOGGER'
)
@responses.activate
@mock_s3_deprecated
def
test_cielo24_callback
(
self
):
def
test_cielo24_callback
(
self
,
mock_logger
):
"""
Verify that `cielo24_transcript_callback` method works as expected.
"""
...
...
@@ -220,6 +221,16 @@ class Cielo24TranscriptTests(APITestCase):
transcripts
.
cielo24_transcript_callback
(
None
,
**
REQUEST_PARAMS
)
# Assert the logs.
mock_logger
.
info
.
assert_called_with
(
'[CIELO24 TRANSCRIPTS] Transcript complete request received for '
'video=
%
s -- org=
%
s -- lang=
%
s -- job_id=
%
s -- iwp_name=
%
s'
,
REQUEST_PARAMS
[
'video_id'
],
REQUEST_PARAMS
[
'org'
],
REQUEST_PARAMS
[
'lang_code'
],
REQUEST_PARAMS
[
'job_id'
],
REQUEST_PARAMS
[
'iwp_name'
]
)
# Total of 4 HTTP requests are made as registered above
self
.
assertEqual
(
len
(
responses
.
calls
),
4
)
...
...
VEDA_OS01/transcripts.py
View file @
ca2b84b0
...
...
@@ -34,7 +34,9 @@ ERROR = 'error'
# Transcript format
TRANSCRIPT_SJSON
=
'sjson'
CIELO24_TRANSCRIPT_COMPLETED
=
django
.
dispatch
.
Signal
(
providing_args
=
[
'job_id'
,
'lang_code'
,
'org'
,
'video_id'
])
CIELO24_TRANSCRIPT_COMPLETED
=
django
.
dispatch
.
Signal
(
providing_args
=
[
'job_id'
,
'iwp_name'
,
'lang_code'
,
'org'
,
'video_id'
])
CONFIG
=
utils
.
get_config
()
# Cielo24 API URLs
...
...
@@ -129,7 +131,7 @@ class Cielo24CallbackHandlerView(APIView):
"""
Handle Cielo24 callback request.
"""
required_attrs
=
(
'job_id'
,
'lang_code'
,
'org'
,
'video_id'
)
required_attrs
=
(
'job_id'
,
'
iwp_name'
,
'
lang_code'
,
'org'
,
'video_id'
)
missing
=
[
attr
for
attr
in
required_attrs
if
attr
not
in
request
.
query_params
.
keys
()]
if
missing
:
LOGGER
.
warning
(
...
...
@@ -142,6 +144,7 @@ class Cielo24CallbackHandlerView(APIView):
sender
=
self
,
org
=
request
.
query_params
[
'org'
],
job_id
=
request
.
query_params
[
'job_id'
],
iwp_name
=
request
.
query_params
[
'iwp_name'
],
video_id
=
request
.
query_params
[
'video_id'
],
lang_code
=
request
.
query_params
[
'lang_code'
],
)
...
...
@@ -162,14 +165,17 @@ def cielo24_transcript_callback(sender, **kwargs):
org
=
kwargs
[
'org'
]
job_id
=
kwargs
[
'job_id'
]
video_id
=
kwargs
[
'video_id'
]
iwp_name
=
kwargs
[
'iwp_name'
]
lang_code
=
kwargs
[
'lang_code'
]
LOGGER
.
info
(
'[CIELO24 TRANSCRIPTS] Transcript complete request received for video=
%
s -- org=
%
s -- lang=
%
s -- job_id=
%
s'
,
'[CIELO24 TRANSCRIPTS] Transcript complete request received for '
'video=
%
s -- org=
%
s -- lang=
%
s -- job_id=
%
s -- iwp_name=
%
s'
,
video_id
,
org
,
lang_code
,
job_id
job_id
,
iwp_name
)
# get transcript credentials for an organization
...
...
control/tests/test_deliver_cielo.py
View file @
ca2b84b0
...
...
@@ -149,11 +149,13 @@ class Cielo24TranscriptTests(TestCase):
lang_code
=
'TARGET_LANG'
,
video_id
=
'12345'
,
job_id
=
'000-111-222'
,
iwp_name
=
'{iwp_name}'
,
org
=
'MAx'
,
),
api_token
=
'cielo24_api_key'
,
priority
=
'PRIORITY'
,
transcription_fidelity
=
'PROFESSIONAL'
,
options
=
'{"return_iwp": ["FINAL"]}'
),
'body'
:
None
,
'method'
:
'GET'
...
...
control/veda_deliver_cielo.py
View file @
ca2b84b0
...
...
@@ -3,7 +3,7 @@ Cielo24 Integration
"""
import
ast
import
logging
import
urllib
import
json
import
requests
from
requests.packages.urllib3.exceptions
import
InsecurePlatformWarning
...
...
@@ -119,6 +119,7 @@ class Cielo24Transcript(object):
callback_url
=
build_url
(
self
.
callback_base_url
,
job_id
=
job_id
,
iwp_name
=
'{iwp_name}'
,
lang_code
=
lang_code
,
org
=
self
.
org
,
video_id
=
self
.
video
.
studio_id
...
...
@@ -135,6 +136,7 @@ class Cielo24Transcript(object):
api_token
=
self
.
api_key
,
priority
=
self
.
turnaround
,
transcription_fidelity
=
self
.
fidelity
,
options
=
json
.
dumps
({
"return_iwp"
:
[
"FINAL"
]})
)
)
...
...
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