diff --git a/sorter.py b/sorter.py index bf58cccda5e5f405449a2a6da47d3e93d7a1fcac..4fb0dffafc72877a3422b33e432065ceed89cb91 100644 --- a/sorter.py +++ b/sorter.py @@ -226,7 +226,9 @@ def sort_now(): for mountpoint in config['VIDEOMOUNT']: existingvideos = query('SELECT videos.path FROM videos JOIN lectures ON (videos.lecture_id = lectures.id) WHERE lectures.course_id = ?',course['id']) knownerrors = query('SELECT sorterrorlog.path FROM sorterrorlog WHERE sorterrorlog.course_id = ?',course['id']) - ignorefiles = existingvideos + knownerrors + ignorefiles = [] + for path in existingvideos + knownerrors: + ignorefiles.append(os.path.basename(path)) lectures = query('SELECT * from lectures where course_id = ?',course['id']) coursepath = mountpoint['mountpoint']+course['handle'] try: @@ -236,14 +238,7 @@ def sort_now(): for filename in files: try: # if the video is in the table "videos" already (with the correct course), skip it - ignore = False - for file_to_ignore in ignorefiles: - # path is something like - # vpnonline/08ws-swt/08ws-swt-081118.mp4 - if os.path.basename(filename) == os.path.basename(file_to_ignore['path']): - ignore = True - break - if ignore: + if os.path.basename(filename) in ignorefiles: continue if not os.path.splitext(filename)[1] == '.mp4': continue