Skip to content
Snippets Groups Projects
Select Git revision
  • 1591a704e00b42e9df63d83e423e6fbcdef9eef9
  • main default protected
  • ci_test
  • v2.0.27 protected
  • v2.0.26 protected
  • v2.0.25 protected
  • v2.0.24 protected
  • v2.0.23 protected
  • v2.0.22 protected
  • v2.0.21 protected
  • v2.0.20 protected
  • v2.0.19 protected
  • v2.0.18 protected
  • v2.0.17 protected
  • v2.0.16 protected
  • v2.0.15 protected
  • v2.0.14 protected
  • v2.0.13 protected
  • v2.0.12 protected
  • v2.0.11 protected
  • v2.0.10 protected
  • v2.0.9 protected
  • v2.0.8 protected
23 results

test_config_override.py

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    encoding.py 1.27 KiB
    from server import *
    
    @job_handler('probe', 'probe-raw')
    def import_xmp_chapters(jobid, jobtype, data, state, status):
    	if 'lecture_id' not in data and data.get('import-chapters', False):
    		return
    	times = set()
    	# Only add new chapters, deleted chapters are taken into account here
    	for chapter in query('SELECT * FROM chapters WHERE lecture_id = ?', data['lecture_id']):
    		for offset in range(5):
    			times.add(chapter['time']-offset)
    			times.add(chapter['time']+offset)
    	for chapter in status.get('xmp_chapters', []):
    		if int(chapter['time']) in times:
    			continue
    		modify('INSERT INTO chapters (lecture_id, time, text, visible, time_created, time_updated) VALUES (?, ?, ?, 0, ?, ?)',
    				data['lecture_id'], int(chapter['time']), chapter['text'],
    				datetime.now(), datetime.now())
    
    @job_handler('probe', 'remux', 'transcode')
    def update_video_metadata(jobid, jobtype, data, state, status):
    	if 'video_id' not in data:
    		return
    	if jobtype not in ['remux', 'transcode']:
    		video = query('SELECT * FROM videos WHERE id = ?', data['video_id'])[0]
    		if video['hash'] and video['hash'] != status['hash']:
    			print('Hash mismatch for video', data['video_id'])
    			return
    	modify('UPDATE videos_data SET hash = ?, file_size = ? WHERE id = ?',
    			status['hash'], status['filesize'], data['video_id'])