'Courses that are imported with the --nostatic flag do not show
transcripts/captions properly even if those captions are stored inside
their static folder. This adds a last resort method of redirecting to
the static asset path of the course if the transcript can\'t be found
inside the contentstore and the course has the static_asset_path field
set.
transcripts (dict): A dict with all transcripts and a sub.'

def get_static_transcript(self, request, transcripts):

    response = Response(status=404)
    if (not (self.transcript_language == 'en')):
        return response
    if (not isinstance(self.course_id, CourseLocator)):
        return response
    video_id = request.GET.get('videoId', None)
    if video_id:
        transcript_name = video_id
    else:
        transcript_name = transcripts['sub']
    if transcript_name:
        asset_path = None
        course = self.descriptor.runtime.modulestore.get_course(self.course_id)
        if course.static_asset_path:
            asset_path = course.static_asset_path
        else:
            asset_path = getattr(course, 'data_dir', '')
        if asset_path:
            response = Response(status=307, location='/static/{0}/{1}'.format(asset_path, subs_filename(transcript_name, self.transcript_language)))
    return response
