From 884ce22ff800b01eeab7ae4cc6eaa27cc58650f3 Mon Sep 17 00:00:00 2001 From: Benjamin Loison Date: Fri, 24 Feb 2023 15:38:51 +0100 Subject: [PATCH] Make the website support regex for both search and path filtering --- website/index.php | 4 ++-- website/search.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/website/index.php b/website/index.php index ad2d919..5ad2761 100644 --- a/website/index.php +++ b/website/index.php @@ -13,8 +13,8 @@ Access raw data with: .
Access found channels with: .
-
-
+
+
diff --git a/website/search.py b/website/search.py index 2864931..31b3fd4 100755 --- a/website/search.py +++ b/website/search.py @@ -42,14 +42,14 @@ for fileIndex, file in enumerate(files): if searchOnlyCaptions and not endsWithVtt: continue toWrite = f'{file}/{fileInZip}' - if not pathSearch in toWrite: + if not bool(re.search(pathSearch, toWrite)): continue with zip.open(fileInZip) as f: if endsWithVtt: content = f.read().decode('utf-8') stringIOf = StringIO(content) wholeCaption = ' '.join([cleanCaption(caption.text) for caption in webvtt.read_buffer(stringIOf)]) - messagePositions = [m.start() for m in re.finditer(f'(?={message})', wholeCaption)] + messagePositions = [m.start() for m in re.finditer(message, wholeCaption)] if messagePositions != []: timestamps = [] for messagePosition in messagePositions: