diff --git a/sorter.py b/sorter.py
index 44995330bf5635596d46c73ac053d0ebf63a31e8..22f4efceb11661cd06558c81180ea8a9f4d3101b 100644
--- a/sorter.py
+++ b/sorter.py
@@ -39,11 +39,12 @@ def update_video_metadata(jobid, jobtype, data, state, status):
 			status['hash'], status['filesize'], data['video_id'])
 
 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 
 		(lecture_id, visible, path, video_format, title, comment, internal, file_modified, time_created, time_updated, created_by, hash, file_size)
 		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())
 	schedule_thumbnail(lectureid)
 	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):
 		return
 	if 'video_id' in data:
 		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 
 		(lecture_id, visible, path, video_format, title, comment, internal, file_modified, time_created, time_updated, created_by, hash, file_size, source)
 		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'],
 		status['filesize'], data['source_id'])
 	schedule_thumbnail(data['lecture_id'])