From ca91307f5bd42e949a4127babf1325b73d3fac94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20K=C3=BCnzel?= <simonk@fsmpi.rwth-aachen.de> Date: Tue, 14 May 2024 23:46:25 +0200 Subject: [PATCH] Fix sql statement --- importer.py | 2 +- sorter.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/importer.py b/importer.py index 90a5a6e..bb95690 100644 --- a/importer.py +++ b/importer.py @@ -101,7 +101,7 @@ def fetch_co_course_events(i): j['place'] = str(j['place']) if j['place'] != '': # info: sql no test cover - dbplace = query("SELECT name FROM places WHERE (campus_room = ?) OR (campus_name = ?) OR ((NOT campus_name) AND name = ?)", + dbplace = query("SELECT name FROM places WHERE (campus_room = ?) OR (campus_name = ?) OR (campus_name = '' AND name = ?)", j['place'], j['place'], j['place']) if dbplace: e['place'] = dbplace[0]['name'] diff --git a/sorter.py b/sorter.py index b78017e..94a097e 100644 --- a/sorter.py +++ b/sorter.py @@ -69,7 +69,7 @@ def insert_video(lectureid, dbfilepath, fileformatid, hash="", filesize=-1, dura query('INSERT INTO sortlog (lecture_id,video_id,path,"when") VALUES (?,?,?,?)', lectureid, video_id, dbfilepath, datetime.now()) schedule_job('probe', {'path': dbfilepath, 'lecture_id': lectureid, 'video_id': video_id, 'import-chapters': True}) schedule_thumbnail(lectureid) - video = query('SELECT videos.*, "format" AS sep, formats.* FROM videos JOIN formats ON formats.id = videos.video_format WHERE videos.id = ?', video_id)[0] + video = query('SELECT videos.*, \'format\' AS sep, formats.* FROM videos JOIN formats ON formats.id = videos.video_format WHERE videos.id = ?', video_id)[0] lecture = query('SELECT * FROM lectures WHERE id = ?', lectureid)[0] course = query('SELECT * FROM courses WHERE id = ?', lecture['course_id'])[0] notify_mods('new_video', course['id'], course=course, lecture=lecture, video=video) -- GitLab