diff options
| author | tguinot | 2020-02-10 03:31:07 +0100 |
|---|---|---|
| committer | jvoisin | 2020-02-11 17:23:11 +0100 |
| commit | 56d2c4aa5fea506abb15d71b53aea23b9dd3398b (patch) | |
| tree | 16a35a9e88694e227584513d7b0e4a3499844e67 /libmat2/video.py | |
| parent | 12f23e0150906ccfac03254276a6af4bbe74f7c8 (diff) | |
Add which pathfinding for executables
Diffstat (limited to '')
| -rw-r--r-- | libmat2/video.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/libmat2/video.py b/libmat2/video.py index 2b33bc0..b4a3232 100644 --- a/libmat2/video.py +++ b/libmat2/video.py | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | import subprocess | 1 | import subprocess |
| 2 | import functools | 2 | import functools |
| 3 | import os | 3 | import shutil |
| 4 | import logging | 4 | import logging |
| 5 | 5 | ||
| 6 | from typing import Dict, Union | 6 | from typing import Dict, Union |
| @@ -137,9 +137,8 @@ class MP4Parser(AbstractFFmpegParser): | |||
| 137 | 137 | ||
| 138 | @functools.lru_cache() | 138 | @functools.lru_cache() |
| 139 | def _get_ffmpeg_path() -> str: # pragma: no cover | 139 | def _get_ffmpeg_path() -> str: # pragma: no cover |
| 140 | ffmpeg_path = '/usr/bin/ffmpeg' | 140 | which_path = shutil.which('ffmpeg') |
| 141 | if os.path.isfile(ffmpeg_path): | 141 | if which_path: |
| 142 | if os.access(ffmpeg_path, os.X_OK): | 142 | return which_path |
| 143 | return ffmpeg_path | ||
| 144 | 143 | ||
| 145 | raise RuntimeError("Unable to find ffmpeg") | 144 | raise RuntimeError("Unable to find ffmpeg") |
