Added: functionality to create single and multiline webvtt
This commit is contained in:
+43
-7
@@ -4,24 +4,60 @@
|
||||
# this file is released under public domain and you can use without limitations
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
import io
|
||||
#from transcription_tools import create_vtt
|
||||
transcription_tools = local_import('transcription_tools', reload=True)
|
||||
|
||||
# app_folder = ''
|
||||
# video_path = 'applications/transcription/uploads/media_file.file.bc22f2543688e775.aW1hZ2VmaWxtX2V0ZWFjaGluZ29yZy5tcDQ=.mp4'
|
||||
model = 'private/model'
|
||||
|
||||
|
||||
# ---- example index page ----
|
||||
def index():
|
||||
media_files = db().select(db.media_file.ALL, orderby=db.media_file.title)
|
||||
return dict(media_files=media_files)
|
||||
|
||||
|
||||
@auth.requires_membership('manager')
|
||||
def manage():
|
||||
def manage():
|
||||
grid = SQLFORM.smartgrid(db.media_file, linked_tables=['post'])
|
||||
return dict(grid=grid)
|
||||
|
||||
def vtt():
|
||||
video_path = '/home/mschmidt/Videos/100-Meinungen-Video-erstellen.mp4'
|
||||
model_path = 'applications/transcription/private/model'
|
||||
return dict(message=transcription_tools.create_vtt(model_path, video_path))
|
||||
|
||||
|
||||
def webvtt_single_line():
|
||||
media_file = db.media_file(request.args(0, cast=int)) or redirect(URL('index'))
|
||||
media_path = '{}/{}/{}'.format(request.folder, 'uploads', media_file.file)
|
||||
model_path = '{}/{}'.format(request.folder, model)
|
||||
transkription = transcription_tools.vtt_single_line(model_path, media_path)
|
||||
db(db.media_file.id == media_file.id).update(vtt_single_line=transkription)
|
||||
redirect(request.env.http_referer)
|
||||
|
||||
def webvtt():
|
||||
media_file = db.media_file(request.args(0, cast=int)) or redirect(URL('index'))
|
||||
media_path = '{}/{}/{}'.format(request.folder, 'uploads', media_file.file)
|
||||
model_path = '{}/{}'.format(request.folder, model)
|
||||
transkription = transcription_tools.vtt(model_path, media_path)
|
||||
db(db.media_file.id == media_file.id).update(vtt=transkription)
|
||||
redirect(request.env.http_referer)
|
||||
|
||||
|
||||
def download_webvtt_single_line():
|
||||
media_file = db.media_file(request.args(0, cast=int)) or redirect(URL('index'))
|
||||
webvtt = media_file.vtt_single_line
|
||||
response.headers['Content-Type']='text/vtt'
|
||||
response.headers['Content-Disposition']='attachment; filename=transcript.vtt'
|
||||
f = io.StringIO(webvtt)
|
||||
return(f)
|
||||
|
||||
def download_webvtt():
|
||||
media_file = db.media_file(request.args(0, cast=int)) or redirect(URL('index'))
|
||||
webvtt = media_file.vtt
|
||||
response.headers['Content-Type']='text/vtt'
|
||||
response.headers['Content-Disposition']='attachment; filename=transcript.vtt'
|
||||
f = io.StringIO(webvtt)
|
||||
return(f)
|
||||
|
||||
|
||||
def user():
|
||||
return dict(form=auth())
|
||||
return dict(form=auth())
|
||||
|
||||
Reference in New Issue
Block a user