Commit 35d550d2 authored by jvoisin's avatar jvoisin

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.
parent aa52a5c9
Pipeline #24774 passed with stages
in 3 minutes and 28 seconds
import functools
import json
import logging
import os
......@@ -56,6 +57,7 @@ class ExiftoolParser(abstract.AbstractParser):
return False
return True
@functools.lru_cache()
def _get_exiftool_path() -> str: # pragma: no cover
possible_pathes = {
'/usr/bin/exiftool', # debian/fedora
......
import functools
import os
import logging
......@@ -130,6 +131,7 @@ class MP4Parser(AbstractFFmpegParser):
}
@functools.lru_cache()
def _get_ffmpeg_path() -> str: # pragma: no cover
ffmpeg_path = '/usr/bin/ffmpeg'
if os.path.isfile(ffmpeg_path):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment