From 48c4a80dfd735e6c85c45783dff42a8ee6f9d468 Mon Sep 17 00:00:00 2001 From: Leo Vivier Date: Sun, 30 Oct 2022 07:10:28 +0100 Subject: Try to fix regexps --- roles/caption/templates/process-captions.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'roles/caption/templates') 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 -- cgit v1.2.3