Skip to content
Snippets Groups Projects
Commit fea06642 authored by Julian Rother's avatar Julian Rother
Browse files

Implemented autovisible

parent 47a3dc4b
No related branches found
No related tags found
No related merge requests found
...@@ -39,11 +39,12 @@ def update_video_metadata(jobid, jobtype, data, state, status): ...@@ -39,11 +39,12 @@ def update_video_metadata(jobid, jobtype, data, state, status):
status['hash'], status['filesize'], data['video_id']) status['hash'], status['filesize'], data['video_id'])
def insert_video(lectureid, dbfilepath, fileformatid, hash="", filesize=-1): def insert_video(lectureid, dbfilepath, fileformatid, hash="", filesize=-1):
visible = query('SELECT courses.autovisible FROM courses JOIN lectures ON lectures.course_id = courses.id WHERE lectures.id = ?', lectureid)[0]['autovisible']
video_id = modify('''INSERT INTO videos_data video_id = modify('''INSERT INTO videos_data
(lecture_id, visible, path, video_format, title, comment, internal, file_modified, time_created, time_updated, created_by, hash, file_size) (lecture_id, visible, path, video_format, title, comment, internal, file_modified, time_created, time_updated, created_by, hash, file_size)
VALUES VALUES
(?, 0, ?, ?, "", "", "", ?, ?, ?, ?, ?, ?)''', (?, ?, ?, ?, "", "", "", ?, ?, ?, ?, ?, ?)''',
lectureid, dbfilepath, fileformatid, datetime.now(), datetime.now(), datetime.now(), -1, hash, filesize) lectureid, autovisible, dbfilepath, fileformatid, datetime.now(), datetime.now(), datetime.now(), -1, hash, filesize)
query('INSERT INTO sortlog (lecture_id,video_id,path,`when`) VALUES (?,?,?,?)', lectureid, video_id, dbfilepath, datetime.now()) query('INSERT INTO sortlog (lecture_id,video_id,path,`when`) VALUES (?,?,?,?)', lectureid, video_id, dbfilepath, datetime.now())
schedule_thumbnail(lectureid) schedule_thumbnail(lectureid)
schedule_job('probe', {'path': dbfilepath, 'lecture_id': lectureid, 'video_id': video_id, 'import-chapters': True}) schedule_job('probe', {'path': dbfilepath, 'lecture_id': lectureid, 'video_id': video_id, 'import-chapters': True})
...@@ -70,11 +71,12 @@ def insert_transcoded_video(jobid, jobtype, data, state, status): ...@@ -70,11 +71,12 @@ def insert_transcoded_video(jobid, jobtype, data, state, status):
return return
if 'video_id' in data: if 'video_id' in data:
return return
visible = query('SELECT courses.autovisible FROM courses JOIN lectures ON lectures.course_id = courses.id WHERE lectures.id = ?', data['lecture_id'])[0]['autovisible']
video_id = modify('''INSERT INTO videos_data video_id = modify('''INSERT INTO videos_data
(lecture_id, visible, path, video_format, title, comment, internal, file_modified, time_created, time_updated, created_by, hash, file_size, source) (lecture_id, visible, path, video_format, title, comment, internal, file_modified, time_created, time_updated, created_by, hash, file_size, source)
VALUES VALUES
(?, 0, ?, ?, "", "", "", ?, ?, ?, ?, ?, ?, ?)''', (?, ?, ?, ?, "", "", "", ?, ?, ?, ?, ?, ?, ?)''',
data['lecture_id'], data['output']['path'], data['format_id'], data['lecture_id'], visible, data['output']['path'], data['format_id'],
datetime.now(), datetime.now(), datetime.now(), -1, status['hash'], datetime.now(), datetime.now(), datetime.now(), -1, status['hash'],
status['filesize'], data['source_id']) status['filesize'], data['source_id'])
schedule_thumbnail(data['lecture_id']) schedule_thumbnail(data['lecture_id'])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment