From a6fbfb3bbae0353821e864302c8a69953b0132c4 Mon Sep 17 00:00:00 2001
From: Dominic <git@msrd0.de>
Date: Mon, 15 Jan 2024 13:49:12 +0100
Subject: [PATCH] WEBM support

---
 sorter.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/sorter.py b/sorter.py
index 690f5b3..395b4be 100644
--- a/sorter.py
+++ b/sorter.py
@@ -77,10 +77,10 @@ def split_filename(filename):
 	return filename.replace('_', '-').replace(' ', '-').split('-')
 
 def parse_filename(filename):
-	# filenames: <handle>-<sorter>-<format>.mp4, split at '-' into an array
+	# filenames: <handle>-<sorter>-<format>.<ext>, split at '-' into an array
 	data = {'keywords': []}
 	for chunk in filename:
-		chunk = chunk.replace('.mp4', '')
+		chunk = chunk.replace('.mp4', '').replace('.webm', '')
 		#-<YYMMDD> (date)
 		#-<HHMM> (time)
 		#-<keyword>
@@ -226,7 +226,8 @@ def sort_now():
 					# if the video is in the table "videos" already (with the correct course), skip it
 					if os.path.basename(filename) in ignorefiles:
 						continue
-					if not os.path.splitext(filename)[1] == '.mp4':
+					ext = os.path.splitext(filename)[1]
+					if not ext == '.mp4' and not ext == '.webm':
 						continue
 					matches, fmt = sort_file(filename, course=course, lectures=lectures)
 					dbfilepath = mountpoint['prefix']+course['handle']+'/'+filename
-- 
GitLab