Commit 35b7e9f7 authored by Julian Rother's avatar Julian Rother
Browse files

Implementet metadata remuxing

parent 1d152578
......@@ -29,3 +29,43 @@ def update_video_metadata(jobid, jobtype, data, state, status):
modify('UPDATE videos_data SET hash = ?, file_size = ? WHERE id = ?',
status['hash'], status['filesize'], data['video_id'])
def schedule_remux(lectureid):
lecture = query('SELECT * FROM lectures WHERE id = ?', lectureid)[0]
course = query('SELECT * FROM courses WHERE id = ?', lecture['course_id'])[0]
chapters = query('SELECT text, time FROM chapters WHERE lecture_id = ?', lectureid)
videos = query('SELECT videos.*, sources.path AS srcpath, sources.hash AS srchash FROM videos JOIN sources ON videos.source = WHERE videos.lecture_id = ?', lectureid)
metadata = {'title': lecture['title'], 'album': course['title'],
'description': lecture['comment'],
'date': lecture['time'].strftime('%m/%d/%Y'),
'artist': lecture['speaker'] if lecture['speaker'] else course['organizer']}
for video in videos:
if not video['source']:
data = {'video_id': video['id'], 'path': video['path'],
'srcpath': video['srcpath'], 'srchash': video['srchash'],
'chapters': chapters, 'metadata': metadata}
schedule_job('remux', data)
def chapter_changed(table, column, value, id):
chapters = query('SELECT * FROM chapters WHERE id = ?', id)
if not chapters:
chapter = chapters[0]
if column in ['visible', 'deleted'] or (chapter['visible'] and not chapter['deleted']):
def course_changed(table, column, value, id):
if column not in ['title', 'organizer']:
lectures = query('SELECT * FROM lectures WHERE course_id = ?', id)
for lecture in lectures:
def lecture_changed(table, column, value, id):
if column in ['title', 'comment', 'time', 'speaker']:
Supports Markdown
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