diff options
| author | jvoisin | 2019-05-16 00:31:40 +0200 |
|---|---|---|
| committer | jvoisin | 2019-05-16 00:31:40 +0200 |
| commit | 35d550d229b219f5a02cb9194c3bd24329f975ed (patch) | |
| tree | 83b3617d7d0993ff0313d472adf8abb5a52fa1ac /libmat2/video.py | |
| parent | aa52a5c91c1d7f0dc6691fdd972e343fc63f6fc2 (diff) | |
Use memoization get _*_path() functions
This shouldn't make a big difference in the CLI/extension
usage, but might improve the performances of long-running
instances, or people misusing the API.
Diffstat (limited to 'libmat2/video.py')
| -rw-r--r-- | libmat2/video.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libmat2/video.py b/libmat2/video.py index 0060f78..1492ba1 100644 --- a/libmat2/video.py +++ b/libmat2/video.py | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | import functools | ||
| 1 | import os | 2 | import os |
| 2 | import logging | 3 | import logging |
| 3 | 4 | ||
| @@ -130,6 +131,7 @@ class MP4Parser(AbstractFFmpegParser): | |||
| 130 | } | 131 | } |
| 131 | 132 | ||
| 132 | 133 | ||
| 134 | @functools.lru_cache() | ||
| 133 | def _get_ffmpeg_path() -> str: # pragma: no cover | 135 | def _get_ffmpeg_path() -> str: # pragma: no cover |
| 134 | ffmpeg_path = '/usr/bin/ffmpeg' | 136 | ffmpeg_path = '/usr/bin/ffmpeg' |
| 135 | if os.path.isfile(ffmpeg_path): | 137 | if os.path.isfile(ffmpeg_path): |
