Commit d65a147f authored by Andreas Valder's avatar Andreas Valder

temporary commit

parent 182fb778
......@@ -10,6 +10,13 @@ def set_metadata(dest, course, lecture):
dest['metadata'] = metadata
dest['chapters'] = chapters
def schedule_intro(lectureid):
lecture = query('SELECT * FROM lectures where id = ?', lectureid)
course = query('SELECT * FROM course where id = ?', lecture['course_id'])
data = {'path': path, 'lecture_id': lectureid}
set_metadata(data, course, lecture)
schedule_job('intro', data)
def schedule_remux(lectureid, videoid=None):
lecture = query('SELECT * FROM lectures WHERE id = ?', lectureid)[0]
course = query('SELECT * FROM courses WHERE id = ?', lecture['course_id'])[0]
......@@ -87,30 +94,35 @@ def add_reencode_job():
schedule_transcode(source, video=video)
return redirect(request.values.get('ref', url_for('jobs_overview')))
@job_handler('probe-raw')
@job_handler('probe-raw', 'intro')
def update_lecture_videos(jobid, jobtype, data, state, status):
if 'lecture_id' not in data:
return
if 'source_id' not in data:
modify('INSERT INTO sources (lecture_id, path, type, hash, time_created) VALUES (?, ?, ?, ?, ?)',
data['lecture_id'], data['path'], 'plain', status['hash'], datetime.now())
if jobtype == 'probe-raw':
if 'source_id' not in data:
modify('INSERT INTO sources (lecture_id, path, type, hash, time_created) VALUES (?, ?, ?, ?, ?)',
data['lecture_id'], data['path'], 'plain', status['hash'], datetime.now())
sources = query('SELECT * FROM sources WHERE sources.lecture_id = ? ORDER BY time_created', data['lecture_id'])
if not sources:
return
latest = sources[-1]
videos = query('SELECT * FROM videos WHERE videos.lecture_id = ?', data['lecture_id'])
current_fmts = [v['video_format'] for v in videos]
formats = query('''SELECT formats.* FROM formats
JOIN profiles ON formats.id = profiles.format
JOIN courses ON profiles.name = courses.profile
JOIN lectures ON courses.id = lectures.course_id
WHERE lectures.id = ?''', data['lecture_id'])
for fmt in formats:
if fmt['id'] not in current_fmts:
schedule_transcode(latest, fmt_id=fmt['id'])
for video in videos:
if video['source'] != latest['id']:
schedule_transcode(latest, video=video)
lecture = query('SELECT * FROM lectures where id = ?', data['lecture_id'])
if 'lecture is autointro' and jobtype == 'probe-raw':
schedule_intro(data['lecture_id'])
else:
videos = query('SELECT * FROM videos WHERE videos.lecture_id = ?', data['lecture_id'])
current_fmts = [v['video_format'] for v in videos]
formats = query('''SELECT formats.* FROM formats
JOIN profiles ON formats.id = profiles.format
JOIN courses ON profiles.name = courses.profile
JOIN lectures ON courses.id = lectures.course_id
WHERE lectures.id = ?''', data['lecture_id'])
for fmt in formats:
if fmt['id'] not in current_fmts:
schedule_transcode(latest, fmt_id=fmt['id'])
for video in videos:
if video['source'] != latest['id']:
schedule_transcode(latest, video=video)
@edit_handler('chapters')
def chapter_changed(table, column, value, id, user):
......
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