summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeo Vivier <zaeph@zaeph.net>2022-10-30 07:10:28 +0100
committerLeo Vivier <zaeph@zaeph.net>2022-10-30 07:10:40 +0100
commit48c4a80dfd735e6c85c45783dff42a8ee6f9d468 (patch)
tree9b73cffd9f872cbbee2a78338af02d9055f3fbfc
parent7e051db8aa749ae689af8013c4af0a54c8479201 (diff)
downloademacsconf-ansible-48c4a80dfd735e6c85c45783dff42a8ee6f9d468.tar.xz
emacsconf-ansible-48c4a80dfd735e6c85c45783dff42a8ee6f9d468.zip
Try to fix regexps
-rwxr-xr-xroles/caption/templates/process-captions.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/roles/caption/templates/process-captions.py b/roles/caption/templates/process-captions.py
index 67f82ce..b650bec 100755
--- a/roles/caption/templates/process-captions.py
+++ b/roles/caption/templates/process-captions.py
@@ -40,8 +40,8 @@ import json
import torch
THREADS = {{ cpus }}
-VIDEO_REGEXP = '\.(webm|mov|mp4|mkv)$'
-AUDIO_REGEXP = '\.(ogg|opus)$'
+VIDEO_REGEXP = '\\.(webm|mov|mp4|mkv)$'
+AUDIO_REGEXP = '\\.(ogg|opus)$'
ALWAYS = False
TRIM_AUDIO = False
MODEL = os.environ.get('MODEL', 'large') # Set to tiny for testing
@@ -107,7 +107,7 @@ def extract_audio(work):
if 'Audio: vorbis' in output.decode():
extension = 'ogg'
new_file = work['base'] + '.' + extension
- acodec = 'copy' if re.search('webm$', work['video']) else 'libopus'
+ acodec = 'copy' if re.search('\\.(webm|mp4|mkv)$', work['video']) else 'libopus'
log("Extracting audio from %s acodec %s" % (work['video'], acodec))
output = subprocess.check_output(['ffmpeg', '-y', '-i', work['video'], '-acodec', acodec, '-vn', new_file], stderr=subprocess.STDOUT)
work['audio'] = new_file