Skip to content

Commit

Permalink
catch subprocess.CalledProcessError instead of Exception when calling…
Browse files Browse the repository at this point in the history
… ffmpeg
  • Loading branch information
ruokolt committed Mar 13, 2024
1 parent 35a018e commit 4d0c41a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/submit.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,14 @@ def create_array_input_file(input_dir: str,
for input_file in Path(input_dir).glob("*.*"):
try:
result = subprocess.run(["ffmpeg", "-i", str(input_file)], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
if "Audio:" not in str(result.stderr):
print(
f".. {input_file}: Skip since it's not an audio file."
)
continue
except Exception as e:
except subprocess.CalledProcessError as e:
print(f"Error processing {input_file}: {e}")
continue
if "Audio:" not in str(result.stderr):
print(
f".. {input_file}: Skip since it's not an audio file."
)
continue
existing, missing = get_existing_result_files(input_file, output_dir)
if existing and not missing:
print(
Expand Down

0 comments on commit 4d0c41a

Please sign in to comment.