Skip to content
Snippets Groups Projects
Commit 134e2b15 authored by Andreas Valder's avatar Andreas Valder
Browse files

moved inserting of video in own function

parent c30c4541
No related branches found
No related tags found
No related merge requests found
......@@ -26,6 +26,15 @@ def to_ascii(inputstring):
asciistring = asciistring.replace(charset[0],charset[1])
return asciistring
def insert_video(lectureid,dbfilepath,filepath,fileformatid):
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, os.stat(filepath).st_size)
query('INSERT INTO sortlog (lecture_id,video_id,path,`when`) VALUES (?,?,?,?)', lectureid, video_id, dbfilepath, datetime.now())
@app.route('/sort/now')
@mod_required
@sched_func(600)
......@@ -130,13 +139,7 @@ def sort_now():
if not 'format' in data:
data['format'] = 0
# insert the video into videos_data and log
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,?,?,"","","",?,?,?,?,"",?)''',
matches[0]['id'], dbfilepath, data['format'], datetime.now(), datetime.now(), datetime.now(), -1, os.stat(filepath).st_size)
query('INSERT INTO sortlog (lecture_id,video_id,path,`when`) VALUES (?,?,?,?)', matches[0]['id'], video_id, dbfilepath, datetime.now())
insert_video( matches[0]['id'], dbfilepath, filepath, fileformatid)
else:
# if we couldn't match the video on exactly one lecture, log an error
matches_id = []
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment