1
0
mirror of synced 2024-11-22 01:04:23 +01:00

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:
jvoisin 2019-05-16 00:31:40 +02:00
parent aa52a5c91c
commit 35d550d229
2 changed files with 4 additions and 0 deletions

View File

@ -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

View File

@ -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):