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 json
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
@ -56,6 +57,7 @@ class ExiftoolParser(abstract.AbstractParser):
|
|||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@functools.lru_cache()
|
||||||
def _get_exiftool_path() -> str: # pragma: no cover
|
def _get_exiftool_path() -> str: # pragma: no cover
|
||||||
possible_pathes = {
|
possible_pathes = {
|
||||||
'/usr/bin/exiftool', # debian/fedora
|
'/usr/bin/exiftool', # debian/fedora
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import functools
|
||||||
import os
|
import os
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
@ -130,6 +131,7 @@ class MP4Parser(AbstractFFmpegParser):
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@functools.lru_cache()
|
||||||
def _get_ffmpeg_path() -> str: # pragma: no cover
|
def _get_ffmpeg_path() -> str: # pragma: no cover
|
||||||
ffmpeg_path = '/usr/bin/ffmpeg'
|
ffmpeg_path = '/usr/bin/ffmpeg'
|
||||||
if os.path.isfile(ffmpeg_path):
|
if os.path.isfile(ffmpeg_path):
|
||||||
|
Loading…
Reference in New Issue
Block a user