Beispiel #1
0
def _standard_response(repo, tree):
    transcription_info = repos.transcription_info(tree)
    return dict(
        _progress_dicts(tree, transcription_info),
        custom_css_revision=repos.custom_css_revision(repo),
        speakers=repos.speakers_text(tree),
        transcription_info=transcription_info,
        transcription_info_json=json.dumps(transcription_info),
    )
Beispiel #2
0
def post_speakers_txt(request):
    text = request.POST.getone('text')
    identity_name = request.POST.getone('identity_name')
    identity_email = request.POST.getone('identity_email')
    # Save transcription info.
    repo = repos.repo_from_request(request)
    with repos.commit_lock:
        repo.heads['master'].checkout()
        index = repo.index
        filename = os.path.join(repo.working_dir, 'speakers.txt')
        with open(filename, 'wb') as f:
            f.write(text.encode('utf8'))
        index.add(['speakers.txt'])
        os.environ['GIT_AUTHOR_NAME'] = identity_name
        os.environ['GIT_AUTHOR_EMAIL'] = identity_email
        index.commit('speakers: save')
    # Reload from repo and serve it up.
    master = repo.tree('master')
    text = repos.speakers_text(master)
    return Response(text, content_type='text/plain')
Beispiel #3
0
def speakers_txt(request):
    repo = repos.repo_from_request(request)
    master = repo.tree('master')
    text = repos.speakers_text(master)
    return Response(text, content_type='text/plain')