static_ffmpeg
static_ffmpeg copied to clipboard
add_path with weak=True will always return False
Hi,
I just discovered this tool and I started using it on my project, but I couldn't get it to work in the first place. I wanted to install ffmpeg, but only if it wasn't, so I set the weak flag to True. The result I got from the add_paths method was always False.
By looking up in the code, I understood why. This part in the code is responsible for this behaviour :
if weak:
has_ffmpeg = _has("ffmpeg") is not None
has_ffprobe = _has("ffprobe") is not None
if has_ffmpeg and has_ffprobe:
return False
_has returns a boolean value, but is compared to None. This will always return True !
>>> True is not None # True
>>> False is not None # True
Thus, the method will always return False, even though ffmpeg isn't installed !
Ran into this issue too. #12 is definitely the fix for it.
In the meanwhile, I'm just doing a manual check.
if shutil.which("ffmpeg") is None or shutil.which("ffprobe") is None:
print("Loading ffmpeg")
static_ffmpeg.add_paths()