From 077703e9ddaaea4ea9c42c2f8841f9aad17af0db Mon Sep 17 00:00:00 2001
From: Andreas <andreasv@fsmpi.rwth-aachen.de>
Date: Tue, 4 Oct 2016 19:12:18 +0200
Subject: [PATCH] fixed sorter

---
 sorter.py           | 5 ++---
 static/moderator.js | 1 -
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/sorter.py b/sorter.py
index 7a6f78f..0638dcd 100644
--- a/sorter.py
+++ b/sorter.py
@@ -47,7 +47,7 @@ def sort_now():
 			filepath = coursepath + '/' + f
 			# filenames: <handle>-<sorter>-<format>.mp4
 			# sorter musst be found with fuzzy matching. musst be one or more of the following: (inside the loop)
-			splitfilename = f.split('-')
+			splitfilename = f.replace('_','-').split('-')
 			if not	os.path.splitext(f)[1] == '.mp4':
 				continue
 			data = {'keywords': []}
@@ -105,10 +105,9 @@ def sort_now():
 				# if we found the format, insert the video
 				if 'format' in data:
 					modify('BEGIN')
-					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) VALUES (?,0,?,?,"","","",?,?,?,?,"")',matches[0]['id'],c['handle']+'/'+f,data['format'],datetime.now(),datetime.now(),datetime.now(),session['user']['givenName'])
+					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'],c['handle']+'/'+f,data['format'],datetime.now(),datetime.now(),datetime.now(),session['user']['givenName'],os.stat(coursepath+'/'+f).st_size)
 					query('INSERT INTO sortlog (lecture_id,video_id,path,`when`) VALUES (?,?,?,?)',matches[0]['id'],video_id,c['handle']+'/'+f,datetime.now())
 					modify('COMMIT')
-					print('sorted',[data,f])
 				else:
 					print('unknown format',formatstring,[data,f])
 			else:
diff --git a/static/moderator.js b/static/moderator.js
index 390d49d..d606f46 100644
--- a/static/moderator.js
+++ b/static/moderator.js
@@ -72,7 +72,6 @@ var moderator = {
 		editbtnclick: function (src) {
 			var path  = $($(src)[0]).data('path');
 			var value = $('.editor_value',src.parentElement.parentElement).val();
-//			var value = $(".editor_value")[0].value;
 
 			var editable = $('.moderator_editor');
 			for (var i=0; i<editable.length; i++) {
-- 
GitLab