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.
This commit is contained in:
parent
aa52a5c91c
commit
35d550d229
@ -1,3 +1,4 @@
|
||||
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
|
||||
|
@ -1,3 +1,4 @@
|
||||
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):
|
||||
|
Loading…
Reference in New Issue
Block a user