mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-21 15:36:18 -05:00
Raising FileNotFoundError instead of using assert.
This commit is contained in:
parent
145c5988ce
commit
e471325bb6
1 changed files with 4 additions and 1 deletions
|
|
@ -65,8 +65,11 @@ def extract_captions(path: pathlib.Path) -> Optional[str]:
|
|||
with tempfile.TemporaryDirectory() as directory:
|
||||
directory = pathlib.Path(directory)
|
||||
file_path = directory / 'captions.vtt'
|
||||
|
||||
if file_path.exists():
|
||||
raise FileNotFoundError(f'Cannot not extract captions when file already exists {path}')
|
||||
|
||||
cmd = (FFMPEG_BIN, '-i', str(path.absolute()), file_path)
|
||||
assert not file_path.exists()
|
||||
try:
|
||||
subprocess.check_call(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
except subprocess.SubprocessError:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue