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
c0fa6884
Commit
c0fa6884
authored
Sep 12, 2017
by
muhammad-ammar
Committed by
muzaffaryousaf
Oct 16, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replace 3rdparty transcript urls
parent
b059bd35
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
107 additions
and
23 deletions
+107
-23
VEDA_OS01/transcripts.py
+26
-7
control/tests/test_deliver_3play.py
+2
-1
control/tests/test_deliver_cielo.py
+34
-6
control/veda_deliver.py
+3
-1
control/veda_deliver_3play.py
+12
-2
control/veda_deliver_cielo.py
+17
-6
instance_config.yaml
+7
-0
test_config.yaml
+6
-0
No files found.
VEDA_OS01/transcripts.py
View file @
c0fa6884
...
...
@@ -36,20 +36,39 @@ ERROR = 'error'
# Transcript format
TRANSCRIPT_SJSON
=
'sjson'
CIELO24_TRANSCRIPT_COMPLETED
=
django
.
dispatch
.
Signal
(
providing_args
=
[
'job_id'
,
'lang_code'
,
'org'
,
'video_id'
])
CIELO24_GET_CAPTION_URL
=
'https://api.cielo24.com/api/job/get_caption'
CONFIG
=
utils
.
get_config
()
# Cielo24 API URLs
CIELO24_GET_CAPTION_URL
=
utils
.
build_url
(
CONFIG
[
'cielo24_api_base_url'
],
'api/job/get_caption'
)
# 3PlayMedia callback signal
THREE_PLAY_TRANSCRIPTION_DONE
=
django
.
dispatch
.
Signal
(
providing_args
=
[
'org'
,
'lang_code'
,
'edx_video_id'
,
'file_id'
,
'status'
,
'error_description'
]
)
# 3PlayMedia API URLs.
THREE_PLAY_TRANSCRIPT_URL
=
u'https://static.3playmedia.com/files/{file_id}/transcript.srt'
THREE_PLAY_TRANSLATION_SERVICES_URL
=
u'https://static.3playmedia.com/translation_services'
THREE_PLAY_ORDER_TRANSLATION_URL
=
u'https://api.3playmedia.com/files/{file_id}/translations/order'
THREE_PLAY_TRANSLATION_STATUS_URL
=
u'https://static.3playmedia.com/files/{file_id}/translations/{translation_id}'
THREE_PLAY_TRANSLATION_DOWNLOAD_URL
=
(
u'https://static.3playmedia.com/files/{file_id}/translations/{translation_id}/'
u'captions.srt'
)
THREE_PLAY_TRANSCRIPT_URL
=
utils
.
build_url
(
CONFIG
[
'three_play_api_transcript_url'
],
'files/{file_id}/transcript.srt'
)
THREE_PLAY_TRANSLATION_SERVICES_URL
=
utils
.
build_url
(
CONFIG
[
'three_play_api_transcript_url'
],
'translation_services'
)
THREE_PLAY_ORDER_TRANSLATION_URL
=
utils
.
build_url
(
CONFIG
[
'three_play_api_base_url'
],
'files/{file_id}/translations/order'
)
THREE_PLAY_TRANSLATION_STATUS_URL
=
utils
.
build_url
(
CONFIG
[
'three_play_api_transcript_url'
],
'files/{file_id}/translations/{translation_id}'
)
THREE_PLAY_TRANSLATION_DOWNLOAD_URL
=
utils
.
build_url
(
CONFIG
[
'three_play_api_transcript_url'
],
'files/{file_id}/translations/{translation_id}/captions.srt'
)
class
TranscriptError
(
Exception
):
...
...
control/tests/test_deliver_3play.py
View file @
c0fa6884
...
...
@@ -53,7 +53,8 @@ class ThreePlayMediaClientTests(TestCase):
'api_key'
:
u'insecure_api_key'
,
'api_secret'
:
u'insecure_api_secret'
,
'turnaround_level'
:
ThreePlayTurnaround
.
DEFAULT
,
'callback_url'
:
'https://veda.edx.org/3playmedia/transcripts/handle/123123?org=MAx&edx_video_id=12345'
'callback_url'
:
'https://veda.edx.org/3playmedia/transcripts/handle/123123?org=MAx&edx_video_id=12345'
,
'three_play_api_base_url'
:
'https://api.3playmedia.com/'
,
}
def
assert_request
(
self
,
received_request
,
expected_request
):
...
...
control/tests/test_deliver_cielo.py
View file @
c0fa6884
...
...
@@ -46,6 +46,7 @@ class Cielo24TranscriptTests(TestCase):
'preferred_languages'
:
[
'en'
,
'ur'
],
's3_video_url'
:
'https://s3.amazonaws.com/bkt/video.mp4'
,
'callback_base_url'
:
'https://veda.edx.org/cielo24/transcript_completed/1234567890'
,
'cielo24_api_base_url'
:
'https://sandbox.cielo24.com/api'
,
}
def
tearDown
(
self
):
...
...
@@ -65,7 +66,7 @@ class Cielo24TranscriptTests(TestCase):
Returns:
absolute url
"""
return
build_url
(
cielo24
.
cielo24_
site
,
endpoint
)
return
build_url
(
cielo24
.
cielo24_
api_base_url
,
endpoint
)
def
assert_request
(
self
,
received_request
,
expected_request
):
"""
...
...
@@ -116,17 +117,44 @@ class Cielo24TranscriptTests(TestCase):
# pylint: disable=line-too-long
expected_data
=
[
{
'url'
:
'https://api.cielo24.com/api/job/new?api_token=cielo24_api_key&job_name=12345&language=en&v=1'
,
'url'
:
build_url
(
'https://sandbox.cielo24.com/api/job/new'
,
v
=
1
,
job_name
=
'12345'
,
language
=
'en'
,
api_token
=
'cielo24_api_key'
,
),
'body'
:
None
,
'method'
:
'GET'
},
{
'url'
:
'https://api.cielo24.com/api/job/add_media?media_url=https
%253
A
%252
F
%252
Fs3.amazonaws.com
%252
Fbkt
%252
Fvideo.mp4&api_token=cielo24_api_key&job_id=000-111-222&v=1'
,
'url'
:
build_url
(
'https://sandbox.cielo24.com/api/job/add_media'
,
v
=
1
,
job_id
=
'000-111-222'
,
api_token
=
'cielo24_api_key'
,
media_url
=
'https://s3.amazonaws.com/bkt/video.mp4'
,
),
'body'
:
None
,
'method'
:
'GET'
'method'
:
'GET'
,
},
{
'url'
:
'https://api.cielo24.com/api/job/perform_transcription?transcription_fidelity=PROFESSIONAL&job_id=000-111-222&v=1&priority=PRIORITY&api_token=cielo24_api_key&callback_url=https
%3
A
%2
F
%2
Fveda.edx.org
%2
Fcielo24
%2
Ftranscript_completed
%2
F1234567890
%3
Flang_code
%3
D{}
%26
video_id
%3
D12345
%26
job_id
%3
D000-111-222
%26
org
%3
DMAx&target_language={}'
,
'url'
:
build_url
(
'https://sandbox.cielo24.com/api/job/perform_transcription'
,
v
=
1
,
job_id
=
'000-111-222'
,
target_language
=
'TARGET_LANG'
,
callback_url
=
build_url
(
'https://veda.edx.org/cielo24/transcript_completed/1234567890'
,
lang_code
=
'TARGET_LANG'
,
video_id
=
'12345'
,
job_id
=
'000-111-222'
,
org
=
'MAx'
,
),
api_token
=
'cielo24_api_key'
,
priority
=
'PRIORITY'
,
transcription_fidelity
=
'PROFESSIONAL'
,
),
'body'
:
None
,
'method'
:
'GET'
}
...
...
@@ -138,7 +166,7 @@ class Cielo24TranscriptTests(TestCase):
# replace target language with appropriate value
if
'api/job/perform_transcription'
in
request_data
[
'url'
]:
request_data
=
dict
(
request_data
)
request_data
[
'url'
]
=
request_data
[
'url'
]
.
format
(
preferred_language
,
preferred_language
)
request_data
[
'url'
]
=
request_data
[
'url'
]
.
replace
(
'TARGET_LANG'
,
preferred_language
)
self
.
assert_request
(
responses
.
calls
[
received_request_index
]
.
request
,
...
...
control/veda_deliver.py
View file @
c0fa6884
...
...
@@ -569,7 +569,8 @@ class VedaDelivery:
self
.
video_query
.
cielo24_fidelity
,
self
.
video_query
.
preferred_languages
,
s3_video_url
,
callback_base_url
callback_base_url
,
self
.
auth_dict
[
'cielo24_api_base_url'
],
)
cielo24
.
start_transcription_flow
()
...
...
@@ -615,6 +616,7 @@ class VedaDelivery:
api_secret
=
transcript_secrets
.
api_secret
,
callback_url
=
callback_url
,
turnaround_level
=
self
.
video_query
.
three_play_turnaround
,
three_play_api_base_url
=
self
.
auth_dict
[
'three_play_api_base_url'
],
)
three_play_media
.
generate_transcripts
()
...
...
control/veda_deliver_3play.py
View file @
c0fa6884
...
...
@@ -45,7 +45,17 @@ class ThreePlayMediaUrlError(ThreePlayMediaError):
class
ThreePlayMediaClient
(
object
):
def
__init__
(
self
,
org
,
video
,
media_url
,
api_key
,
api_secret
,
callback_url
,
turnaround_level
):
def
__init__
(
self
,
org
,
video
,
media_url
,
api_key
,
api_secret
,
callback_url
,
turnaround_level
,
three_play_api_base_url
):
"""
Initialize 3play media client
"""
...
...
@@ -57,7 +67,7 @@ class ThreePlayMediaClient(object):
self
.
callback_url
=
callback_url
self
.
turnaround_level
=
turnaround_level
# default attributes
self
.
base_url
=
u'https://api.3playmedia.com/'
self
.
base_url
=
three_play_api_base_url
self
.
upload_media_file_url
=
u'files/'
self
.
available_languages_url
=
u'caption_imports/available_languages/'
self
.
allowed_content_type
=
u'video/mp4'
...
...
control/veda_deliver_cielo.py
View file @
c0fa6884
...
...
@@ -49,7 +49,18 @@ class Cielo24Transcript(object):
"""
Cielo24 Integration
"""
def
__init__
(
self
,
video
,
org
,
api_key
,
turnaround
,
fidelity
,
preferred_languages
,
s3_video_url
,
callback_base_url
):
def
__init__
(
self
,
video
,
org
,
api_key
,
turnaround
,
fidelity
,
preferred_languages
,
s3_video_url
,
callback_base_url
,
cielo24_api_base_url
):
self
.
org
=
org
self
.
video
=
video
self
.
api_key
=
api_key
...
...
@@ -60,7 +71,7 @@ class Cielo24Transcript(object):
self
.
callback_base_url
=
callback_base_url
# Defaults
self
.
cielo24_
site
=
'https://api.cielo24.com/api'
self
.
cielo24_
api_base_url
=
cielo24_api_base_url
self
.
cielo24_new_job
=
'/job/new'
self
.
cielo24_add_media
=
'/job/add_media'
self
.
cielo24_perform_transcription
=
'/job/perform_transcription'
...
...
@@ -115,7 +126,7 @@ class Cielo24Transcript(object):
response
=
requests
.
get
(
build_url
(
self
.
cielo24_
site
,
self
.
cielo24_
api_base_url
,
self
.
cielo24_perform_transcription
,
v
=
1
,
job_id
=
job_id
,
...
...
@@ -156,12 +167,12 @@ class Cielo24Transcript(object):
"""
response
=
requests
.
get
(
build_url
(
self
.
cielo24_
site
,
self
.
cielo24_
api_base_url
,
self
.
cielo24_add_media
,
v
=
1
,
job_id
=
job_id
,
api_token
=
self
.
api_key
,
media_url
=
urllib
.
quote_plus
(
self
.
s3_video_url
)
media_url
=
self
.
s3_video_url
)
)
...
...
@@ -190,7 +201,7 @@ class Cielo24Transcript(object):
cielo24 job id
"""
create_job_url
=
build_url
(
self
.
cielo24_
site
,
self
.
cielo24_
api_base_url
,
self
.
cielo24_new_job
,
v
=
1
,
language
=
'en'
,
...
...
instance_config.yaml
View file @
c0fa6884
...
...
@@ -55,6 +55,13 @@ s3_base_url: https://s3.amazonaws.com
aws_video_transcripts_bucket
:
aws_video_transcripts_prefix
:
video-transcripts/
# cielo24 api urls
cielo24_api_base_url
:
https://sandbox.cielo24.com/api
# 3playmedia api urls
three_play_api_base_url
:
https://api.3playmedia.com/
three_play_api_transcript_url
:
https://static.3playmedia.com/
# a token identifying a valid request from transcript provider
transcript_provider_request_token
:
test-token
...
...
test_config.yaml
View file @
c0fa6884
...
...
@@ -9,6 +9,12 @@ s3_base_url: https://s3.amazonaws.com
aws_video_transcripts_bucket
:
bucket_name
aws_video_transcripts_prefix
:
video-transcripts/
# cielo24 api urls
cielo24_api_base_url
:
https://sandbox.cielo24.com/api
# 3playmedia api urls
three_play_api_base_url
:
https://api.3playmedia.com/
three_play_api_transcript_url
:
https://static.3playmedia.com/
# a token identifying a valid request from transcript provider
transcript_provider_request_token
:
1234a5a67cr890
...
...
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