Commit e0498f1d by Qubad786

Address feedback, fix tests, rename transcript preferences.

parent 85c3c60f
...@@ -2,7 +2,7 @@ from django.contrib import admin ...@@ -2,7 +2,7 @@ from django.contrib import admin
from VEDA_OS01.models import ( from VEDA_OS01.models import (
Course, Video, Encode, URL, Destination, Institution, VedaUpload, Course, Video, Encode, URL, Destination, Institution, VedaUpload,
TranscriptPreferences, TranscriptProcessMetadata TranscriptCredentials, TranscriptProcessMetadata
) )
...@@ -109,8 +109,8 @@ class VideoUploadAdmin(admin.ModelAdmin): ...@@ -109,8 +109,8 @@ class VideoUploadAdmin(admin.ModelAdmin):
] ]
class TranscriptPreferencesAdmin(admin.ModelAdmin): class TranscriptCredentialsAdmin(admin.ModelAdmin):
model = TranscriptPreferences model = TranscriptCredentials
class TranscriptProcessMetadataAdmin(admin.ModelAdmin): class TranscriptProcessMetadataAdmin(admin.ModelAdmin):
...@@ -124,5 +124,5 @@ admin.site.register(URL, URLAdmin) ...@@ -124,5 +124,5 @@ admin.site.register(URL, URLAdmin)
admin.site.register(Destination, DestinationAdmin) admin.site.register(Destination, DestinationAdmin)
admin.site.register(Institution, InstitutionAdmin) admin.site.register(Institution, InstitutionAdmin)
admin.site.register(VedaUpload, VideoUploadAdmin) admin.site.register(VedaUpload, VideoUploadAdmin)
admin.site.register(TranscriptPreferences, TranscriptPreferencesAdmin) admin.site.register(TranscriptCredentials, TranscriptCredentialsAdmin)
admin.site.register(TranscriptProcessMetadata, TranscriptProcessMetadataAdmin) admin.site.register(TranscriptProcessMetadata, TranscriptProcessMetadataAdmin)
...@@ -619,9 +619,9 @@ class VedaUpload (models.Model): ...@@ -619,9 +619,9 @@ class VedaUpload (models.Model):
) )
class TranscriptPreferences(TimeStampedModel): class TranscriptCredentials(TimeStampedModel):
""" """
Model to contain third party transcription service provider preferances. Model to contain third party transcription service provider preferences.
""" """
org = models.CharField( org = models.CharField(
'Organization', 'Organization',
...@@ -634,7 +634,7 @@ class TranscriptPreferences(TimeStampedModel): ...@@ -634,7 +634,7 @@ class TranscriptPreferences(TimeStampedModel):
class Meta: class Meta:
unique_together = ('org', 'provider') unique_together = ('org', 'provider')
verbose_name_plural = 'Transcript preferences' verbose_name_plural = 'Transcript Credentials'
def __unicode__(self): def __unicode__(self):
return u'{org} - {provider}'.format(org=self.org, provider=self.provider) return u'{org} - {provider}'.format(org=self.org, provider=self.provider)
...@@ -649,7 +649,7 @@ class TranscriptProcessMetadata(TimeStampedModel): ...@@ -649,7 +649,7 @@ class TranscriptProcessMetadata(TimeStampedModel):
process_id = models.CharField('Process id', max_length=255) process_id = models.CharField('Process id', max_length=255)
# To keep track of 3Play Translations. # To keep track of 3Play Translations.
translation_id = models.CharField('Translation id', max_length=255, null=True, blank=True) translation_id = models.CharField('Translation id', max_length=255, null=True, blank=True)
lang_code = models.CharField('Language code', max_length=3) lang_code = models.CharField('Language code', max_length=8)
status = models.CharField( status = models.CharField(
'Transcript status', 'Transcript status',
max_length=50, max_length=50,
......
...@@ -17,7 +17,7 @@ from rest_framework import status ...@@ -17,7 +17,7 @@ from rest_framework import status
from rest_framework.test import APITestCase from rest_framework.test import APITestCase
from VEDA_OS01 import transcripts, utils from VEDA_OS01 import transcripts, utils
from VEDA_OS01.models import (Course, TranscriptPreferences, from VEDA_OS01.models import (Course, TranscriptCredentials,
TranscriptProcessMetadata, TranscriptProvider, TranscriptProcessMetadata, TranscriptProvider,
TranscriptStatus, Video) TranscriptStatus, Video)
...@@ -108,7 +108,7 @@ class Cielo24TranscriptTests(APITestCase): ...@@ -108,7 +108,7 @@ class Cielo24TranscriptTests(APITestCase):
**VIDEO_DATA **VIDEO_DATA
) )
self.transcript_prefs = TranscriptPreferences.objects.create( self.transcript_prefs = TranscriptCredentials.objects.create(
**TRANSCRIPT_PREFERENCES **TRANSCRIPT_PREFERENCES
) )
...@@ -142,10 +142,11 @@ class Cielo24TranscriptTests(APITestCase): ...@@ -142,10 +142,11 @@ class Cielo24TranscriptTests(APITestCase):
REQUEST_PARAMS['video_id'] = self.video.studio_id REQUEST_PARAMS['video_id'] = self.video.studio_id
@data( @data(
{'url': 'cielo24/transcript_completed', 'status_code': 404}, ('cielo24/transcript_completed', 404),
{'url': None, 'status_code': 200}, (None, 200),
) )
@unpack @unpack
@patch('VEDA_OS01.transcripts.CIELO24_TRANSCRIPT_COMPLETED.send_robust', Mock(return_value=None))
def test_provider(self, url, status_code): def test_provider(self, url, status_code):
""" """
Verify that only valid provider requests are allowed . Verify that only valid provider requests are allowed .
...@@ -157,19 +158,26 @@ class Cielo24TranscriptTests(APITestCase): ...@@ -157,19 +158,26 @@ class Cielo24TranscriptTests(APITestCase):
self.assertEqual(response.status_code, status_code) self.assertEqual(response.status_code, status_code)
@data( @data(
{'params': {}}, ({}, ['job_id', 'lang_code', 'org', 'video_id']),
{'params': {'job_id': 1}}, ({'job_id': 1}, ['lang_code', 'org', 'video_id']),
{'params': {'job_id': 2, 'lang_code': 'en'}}, ({'job_id': 2, 'lang_code': 'en'}, ['org', 'video_id']),
{'params': {'job_id': 3, 'lang_code': 'ar', 'org': 'edx'}} ({'job_id': 3, 'lang_code': 'ar', 'org': 'edx'}, ['video_id']),
) )
@unpack @unpack
def test_missing_required_params(self, params): @patch('VEDA_OS01.transcripts.LOGGER')
def test_missing_required_params(self, params, logger_params, mock_logger):
""" """
Verify that 400 response is recevied if any required param is missing. Verify that 400 response is recevied if any required param is missing.
""" """
response = self.client.get(self.url, params) response = self.client.get(self.url, params)
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
mock_logger.warning.assert_called_with(
'[CIELO24 HANDLER] Required params are missing %s',
logger_params,
)
@responses.activate
@patch('VEDA_OS01.transcripts.CIELO24_TRANSCRIPT_COMPLETED.send_robust', Mock(return_value=None))
def test_transcript_callback_get_request(self): def test_transcript_callback_get_request(self):
""" """
Verify that transcript callback get request is working as expected. Verify that transcript callback get request is working as expected.
...@@ -263,7 +271,7 @@ class Cielo24TranscriptTests(APITestCase): ...@@ -263,7 +271,7 @@ class Cielo24TranscriptTests(APITestCase):
with self.assertRaises(transcripts.TranscriptConversionError) as conversion_exception: with self.assertRaises(transcripts.TranscriptConversionError) as conversion_exception:
transcripts.cielo24_transcript_callback(None, **REQUEST_PARAMS) transcripts.cielo24_transcript_callback(None, **REQUEST_PARAMS)
mock_logger.exception.assert_called_with( mock_logger.exception.assert_called_with(
'[CIELO24 TRANSCRIPTS] Request failed for video=%s -- lang=%s -- job_id=%s -- message=%s', '[CIELO24 TRANSCRIPTS] Request failed for video=%s -- lang=%s -- job_id=%s.',
REQUEST_PARAMS['video_id'], REQUEST_PARAMS['video_id'],
REQUEST_PARAMS['lang_code'], REQUEST_PARAMS['lang_code'],
REQUEST_PARAMS['job_id'] REQUEST_PARAMS['job_id']
...@@ -331,7 +339,7 @@ class ThreePlayTranscriptionCallbackTest(APITestCase): ...@@ -331,7 +339,7 @@ class ThreePlayTranscriptionCallbackTest(APITestCase):
**VIDEO_DATA **VIDEO_DATA
) )
self.transcript_prefs = TranscriptPreferences.objects.create( self.transcript_prefs = TranscriptCredentials.objects.create(
org=self.org, org=self.org,
provider=TranscriptProvider.THREE_PLAY, provider=TranscriptProvider.THREE_PLAY,
api_key='insecure_api_key', api_key='insecure_api_key',
...@@ -710,7 +718,7 @@ class ThreePlayTranscriptionCallbackTest(APITestCase): ...@@ -710,7 +718,7 @@ class ThreePlayTranscriptionCallbackTest(APITestCase):
# request - 5 # request - 5
{ {
'url': transcripts.THREE_PLAY_ORDER_TRANSLATION_URL.format(file_id=self.file_id), 'url': transcripts.THREE_PLAY_ORDER_TRANSLATION_URL.format(file_id=self.file_id),
'body': urllib.urlencode({ 'body': json.dumps({
'apikey': self.transcript_prefs.api_key, 'apikey': self.transcript_prefs.api_key,
'api_secret_key': self.transcript_prefs.api_secret, 'api_secret_key': self.transcript_prefs.api_secret,
'translation_service_id': 30, 'translation_service_id': 30,
...@@ -1240,14 +1248,12 @@ class ThreePlayTranscriptionCallbackTest(APITestCase): ...@@ -1240,14 +1248,12 @@ class ThreePlayTranscriptionCallbackTest(APITestCase):
], ],
{ {
'method': 'error', 'method': 'exception',
'args': ( 'args': (
'[3PlayMedia Task] Translation download failed for video=%s -- lang_code=%s -- process_id=%s -- ' '[3PlayMedia Task] Translation download failed for video=%s -- lang_code=%s -- process_id=%s.',
'status=%s',
VIDEO_DATA['studio_id'], VIDEO_DATA['studio_id'],
'ro', 'ro',
'112233', '112233'
400,
) )
}, },
TranscriptStatus.IN_PROGRESS TranscriptStatus.IN_PROGRESS
......
...@@ -20,7 +20,7 @@ from rest_framework.views import APIView ...@@ -20,7 +20,7 @@ from rest_framework.views import APIView
from control.veda_val import VALAPICall from control.veda_val import VALAPICall
from VEDA_OS01 import utils from VEDA_OS01 import utils
from VEDA_OS01.models import (TranscriptPreferences, TranscriptProcessMetadata, from VEDA_OS01.models import (TranscriptCredentials, TranscriptProcessMetadata,
TranscriptProvider, TranscriptStatus, TranscriptProvider, TranscriptStatus,
VideoStatus) VideoStatus)
...@@ -29,11 +29,6 @@ requests.packages.urllib3.disable_warnings(InsecurePlatformWarning) ...@@ -29,11 +29,6 @@ requests.packages.urllib3.disable_warnings(InsecurePlatformWarning)
logging.basicConfig() logging.basicConfig()
LOGGER = logging.getLogger(__name__) LOGGER = logging.getLogger(__name__)
VALID_TRANSCRIPT_PROVIDERS = [
'',
'',
]
# 3PlayMedia possible send-along statuses for a transcription callback. # 3PlayMedia possible send-along statuses for a transcription callback.
COMPLETE = 'complete' COMPLETE = 'complete'
ERROR = 'error' ERROR = 'error'
...@@ -116,9 +111,13 @@ class Cielo24CallbackHandlerView(APIView): ...@@ -116,9 +111,13 @@ class Cielo24CallbackHandlerView(APIView):
""" """
Handle Cielo24 callback request. Handle Cielo24 callback request.
""" """
attrs = ('job_id', 'lang_code', 'org', 'video_id') required_attrs = ('job_id', 'lang_code', 'org', 'video_id')
if not all([attr in request.query_params for attr in attrs]): missing = [attr for attr in required_attrs if attr not in request.query_params.keys()]
LOGGER.warn('[CIELO24 HANDLER] Required params are missing %s', request.query_params.keys()) if missing:
LOGGER.warning(
'[CIELO24 HANDLER] Required params are missing %s',
missing,
)
return Response({}, status=status.HTTP_400_BAD_REQUEST) return Response({}, status=status.HTTP_400_BAD_REQUEST)
CIELO24_TRANSCRIPT_COMPLETED.send_robust( CIELO24_TRANSCRIPT_COMPLETED.send_robust(
...@@ -155,14 +154,14 @@ def cielo24_transcript_callback(sender, **kwargs): ...@@ -155,14 +154,14 @@ def cielo24_transcript_callback(sender, **kwargs):
job_id job_id
) )
# get transcript preferences for an organization # get transcript credentials for an organization
try: try:
transcript_prefs = TranscriptPreferences.objects.get( transcript_prefs = TranscriptCredentials.objects.get(
org=org, org=org,
provider=TranscriptProvider.CIELO24, provider=TranscriptProvider.CIELO24,
) )
except TranscriptPreferences.DoesNotExist: except TranscriptCredentials.DoesNotExist:
LOGGER.exception('[CIELO24 TRANSCRIPTS] Unable to get transcript preferences for job_id=%s', job_id) LOGGER.exception('[CIELO24 TRANSCRIPTS] Unable to get transcript credentials for job_id=%s', job_id)
# mark the transcript for a particular language as ready # mark the transcript for a particular language as ready
try: try:
...@@ -177,7 +176,7 @@ def cielo24_transcript_callback(sender, **kwargs): ...@@ -177,7 +176,7 @@ def cielo24_transcript_callback(sender, **kwargs):
job_id job_id
) )
# if transcript preferences are missing then we can do nothing # if transcript credentials are missing then we can do nothing
if not transcript_prefs and process_metadata: if not transcript_prefs and process_metadata:
process_metadata.status = TranscriptStatus.FAILED process_metadata.status = TranscriptStatus.FAILED
process_metadata.save() process_metadata.save()
...@@ -211,7 +210,7 @@ def cielo24_transcript_callback(sender, **kwargs): ...@@ -211,7 +210,7 @@ def cielo24_transcript_callback(sender, **kwargs):
sjson_file_name = upload_sjson_to_s3(CONFIG, sjson) sjson_file_name = upload_sjson_to_s3(CONFIG, sjson)
except Exception: except Exception:
LOGGER.exception( LOGGER.exception(
'[CIELO24 TRANSCRIPTS] Request failed for video=%s -- lang=%s -- job_id=%s', '[CIELO24 TRANSCRIPTS] Request failed for video=%s -- lang=%s -- job_id=%s.',
video_id, video_id,
lang_code, lang_code,
job_id job_id
...@@ -426,7 +425,7 @@ def order_translations(file_id, api_key, api_secret, target_languages): ...@@ -426,7 +425,7 @@ def order_translations(file_id, api_key, api_secret, target_languages):
continue continue
# 2 - At this point, we've got our service ready to use. Now, place an order for the translation. # 2 - At this point, we've got our service ready to use. Now, place an order for the translation.
response = requests.post(THREE_PLAY_ORDER_TRANSLATION_URL.format(file_id=file_id), data={ response = requests.post(THREE_PLAY_ORDER_TRANSLATION_URL.format(file_id=file_id), json={
'apikey': api_key, 'apikey': api_key,
'api_secret_key': api_secret, 'api_secret_key': api_secret,
'translation_service_id': translation_service_id, 'translation_service_id': translation_service_id,
...@@ -465,6 +464,7 @@ def order_translations(file_id, api_key, api_secret, target_languages): ...@@ -465,6 +464,7 @@ def order_translations(file_id, api_key, api_secret, target_languages):
@django.dispatch.receiver(THREE_PLAY_TRANSCRIPTION_DONE, dispatch_uid="three_play_transcription_done") @django.dispatch.receiver(THREE_PLAY_TRANSCRIPTION_DONE, dispatch_uid="three_play_transcription_done")
def three_play_transcription_callback(sender, **kwargs): def three_play_transcription_callback(sender, **kwargs):
""" """
This is a receiver for 3Play Media callback signal.
Arguments: Arguments:
sender: sender of the signal sender: sender of the signal
...@@ -502,8 +502,8 @@ def three_play_transcription_callback(sender, **kwargs): ...@@ -502,8 +502,8 @@ def three_play_transcription_callback(sender, **kwargs):
if state == COMPLETE: if state == COMPLETE:
# Indicates that the default video speech transcription has been done successfully. # Indicates that the default video speech transcription has been done successfully.
try: try:
transcript_secrets = TranscriptPreferences.objects.get(org=org, provider=TranscriptProvider.THREE_PLAY) transcript_secrets = TranscriptCredentials.objects.get(org=org, provider=TranscriptProvider.THREE_PLAY)
except TranscriptPreferences.DoesNotExist: except TranscriptCredentials.DoesNotExist:
# Fail the process # Fail the process
process.status = TranscriptStatus.FAILED process.status = TranscriptStatus.FAILED
process.save() process.save()
...@@ -676,8 +676,8 @@ def retrieve_three_play_translations(): ...@@ -676,8 +676,8 @@ def retrieve_three_play_translations():
org = utils.extract_course_org(course_id=course_id) org = utils.extract_course_org(course_id=course_id)
try: try:
three_play_secrets = TranscriptPreferences.objects.get(org=org, provider=TranscriptProvider.THREE_PLAY) three_play_secrets = TranscriptCredentials.objects.get(org=org, provider=TranscriptProvider.THREE_PLAY)
except TranscriptPreferences.DoesNotExist: except TranscriptCredentials.DoesNotExist:
LOGGER.exception( LOGGER.exception(
u'[3PlayMedia Task] 3Play secrets not found for video=%s -- lang_code=%s -- process_id=%s', u'[3PlayMedia Task] 3Play secrets not found for video=%s -- lang_code=%s -- process_id=%s',
translation_process.video.studio_id, translation_process.video.studio_id,
...@@ -720,22 +720,19 @@ def retrieve_three_play_translations(): ...@@ -720,22 +720,19 @@ def retrieve_three_play_translations():
continue continue
if translation_status['state'] == 'complete': if translation_status['state'] == 'complete':
translation_download_url = utils.build_url( try:
THREE_PLAY_TRANSLATION_DOWNLOAD_URL.format( response = fetch_srt_data(
file_id=translation_process.process_id, url=THREE_PLAY_TRANSLATION_DOWNLOAD_URL.format(
translation_id=translation_process.translation_id, file_id=translation_process.process_id, translation_id=translation_process.translation_id
), ),
apikey=three_play_secrets.api_key apikey=three_play_secrets.api_key,
) )
response = requests.get(translation_download_url) except TranscriptFetchError:
if not response.ok: LOGGER.exception(
LOGGER.error( u'[3PlayMedia Task] Translation download failed for video=%s -- lang_code=%s -- process_id=%s.',
u'[3PlayMedia Task] Translation download failed for video=%s -- lang_code=%s -- process_id=%s -- '
u'status=%s',
translation_process.video.studio_id, translation_process.video.studio_id,
translation_process.lang_code, translation_process.lang_code,
translation_process.process_id, translation_process.process_id
response.status_code,
) )
continue continue
...@@ -743,7 +740,7 @@ def retrieve_three_play_translations(): ...@@ -743,7 +740,7 @@ def retrieve_three_play_translations():
# ValueError if its a valid response, otherwise it'll be json # ValueError if its a valid response, otherwise it'll be json
# response in result of an error. # response in result of an error.
try: try:
json.loads(response.text) json.loads(response)
translation_process.status = TranscriptStatus.FAILED translation_process.status = TranscriptStatus.FAILED
translation_process.save() translation_process.save()
LOGGER.error( LOGGER.error(
...@@ -762,7 +759,7 @@ def retrieve_three_play_translations(): ...@@ -762,7 +759,7 @@ def retrieve_three_play_translations():
translation_process.save() translation_process.save()
try: try:
sjson_transcript = convert_srt_to_sjson(response.text) sjson_transcript = convert_srt_to_sjson(response)
sjson_file = upload_sjson_to_s3(CONFIG, sjson_transcript) sjson_file = upload_sjson_to_s3(CONFIG, sjson_transcript)
except Exception: except Exception:
# in case of any exception, log and raise. # in case of any exception, log and raise.
......
...@@ -18,7 +18,7 @@ from control_env import * ...@@ -18,7 +18,7 @@ from control_env import *
from veda_deliver_cielo import Cielo24Transcript from veda_deliver_cielo import Cielo24Transcript
from veda_deliver_youtube import DeliverYoutube from veda_deliver_youtube import DeliverYoutube
from VEDA_OS01 import utils from VEDA_OS01 import utils
from VEDA_OS01.models import (TranscriptPreferences, TranscriptProvider, from VEDA_OS01.models import (TranscriptCredentials, TranscriptProvider,
VideoStatus) VideoStatus)
from VEDA_OS01.utils import build_url from VEDA_OS01.utils import build_url
from veda_utils import ErrorObject, Metadata, Output, VideoProto from veda_utils import ErrorObject, Metadata, Output, VideoProto
...@@ -534,8 +534,8 @@ class VedaDelivery: ...@@ -534,8 +534,8 @@ class VedaDelivery:
org = utils.extract_course_org(self.video_proto.platform_course_url[0]) org = utils.extract_course_org(self.video_proto.platform_course_url[0])
try: try:
api_key = TranscriptPreferences.objects.get(org=org, provider=self.video_query.provider).api_key api_key = TranscriptCredentials.objects.get(org=org, provider=self.video_query.provider).api_key
except TranscriptPreferences.DoesNotExist: except TranscriptCredentials.DoesNotExist:
LOGGER.warn('[cielo24] Unable to find api_key for org=%s', org) LOGGER.warn('[cielo24] Unable to find api_key for org=%s', org)
return None return None
...@@ -578,7 +578,7 @@ class VedaDelivery: ...@@ -578,7 +578,7 @@ class VedaDelivery:
# Picks the first course from the list as there may be multiple # Picks the first course from the list as there may be multiple
# course runs in that list (i.e. all having the same org). # course runs in that list (i.e. all having the same org).
org = utils.extract_course_org(self.video_proto.platform_course_url[0]) org = utils.extract_course_org(self.video_proto.platform_course_url[0])
transcript_secrets = TranscriptPreferences.objects.get(org=org, provider=self.video_query.provider) transcript_secrets = TranscriptCredentials.objects.get(org=org, provider=self.video_query.provider)
# update transcript status for video in edx-val # update transcript status for video in edx-val
VALAPICall(video_proto=None, val_status=None).update_video_status( VALAPICall(video_proto=None, val_status=None).update_video_status(
...@@ -612,7 +612,7 @@ class VedaDelivery: ...@@ -612,7 +612,7 @@ class VedaDelivery:
) )
three_play_media.generate_transcripts() three_play_media.generate_transcripts()
except TranscriptPreferences.DoesNotExist: except TranscriptCredentials.DoesNotExist:
LOGGER.warning( LOGGER.warning(
'Transcript preference is not found for provider=%s, video=%s', 'Transcript preference is not found for provider=%s, video=%s',
self.video_query.provider, self.video_query.provider,
......
...@@ -102,11 +102,7 @@ class ThreePLayMediaClient(object): ...@@ -102,11 +102,7 @@ class ThreePLayMediaClient(object):
callback_url=self.callback_url, callback_url=self.callback_url,
) )
upload_url = build_url(self.base_url, self.upload_media_file_url) upload_url = build_url(self.base_url, self.upload_media_file_url)
response = requests.post( response = requests.post(url=upload_url, json=payload)
url=upload_url,
data=json.dumps(payload),
headers={'Content-Type': 'application/json'}
)
if not response.ok: if not response.ok:
raise ThreePlayMediaPerformTranscriptionError( raise ThreePlayMediaPerformTranscriptionError(
......
...@@ -7,7 +7,7 @@ import boto.s3 ...@@ -7,7 +7,7 @@ import boto.s3
from boto.exception import S3ResponseError, S3DataError from boto.exception import S3ResponseError, S3DataError
import yaml import yaml
from VEDA_OS01.models import TranscriptPreferences from VEDA_OS01.models import TranscriptCredentials
from VEDA_OS01.utils import extract_course_org from VEDA_OS01.utils import extract_course_org
try: try:
...@@ -237,12 +237,12 @@ class FileDiscovery(object): ...@@ -237,12 +237,12 @@ class FileDiscovery(object):
# Make decision if this video needs the transcription as well. # Make decision if this video needs the transcription as well.
try: try:
transcript_preferences = json.loads(transcript_preferences) transcript_preferences = json.loads(transcript_preferences)
TranscriptPreferences.objects.get( TranscriptCredentials.objects.get(
org=extract_course_org(course_url), org=extract_course_org(course_url),
provider=transcript_preferences.get('provider') provider=transcript_preferences.get('provider')
) )
process_transcription = True process_transcription = True
except (TypeError, TranscriptPreferences.DoesNotExist): except (TypeError, TranscriptCredentials.DoesNotExist):
# when the preferences are not set OR these are set to some data in invalid format OR these don't # when the preferences are not set OR these are set to some data in invalid format OR these don't
# have associated 3rd party transcription provider API keys. # have associated 3rd party transcription provider API keys.
process_transcription = False process_transcription = False
......
...@@ -3,23 +3,23 @@ ...@@ -3,23 +3,23 @@
# Database information # Database information
# --- # ---
# SANDBOX #SANDBOX
#DATABASES:
# default:
# ENGINE: django.db.backends.sqlite3
# NAME: sandbox.db
## PRODUCTION
DATABASES: DATABASES:
default: default:
ENGINE: 'django.db.backends.mysql' ENGINE: django.db.backends.sqlite3
NAME: NAME: sandbox.db
USER:
PASSWORD: ### PRODUCTION
HOST: #DATABASES:
PORT: '3306' # default:
# ENGINE: 'django.db.backends.mysql'
django_secret_key: "" # NAME:
# USER:
# PASSWORD:
# HOST:
# PORT: '3306'
django_secret_key: insecure_secret_key
# Django DEBUG global # Django DEBUG global
# (set to false in prod) # (set to false in prod)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment