From e70ea811c99c16f3382c08153eda573df0825536 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Thu, 18 Oct 2018 19:19:56 +0200 Subject: Implement support for .avi files, via ffmpeg - This commit introduces optional dependencies (namely ffmpeg): mat2 will spit a warning when trying to process an .avi file if ffmpeg isn't installed. - Since metadata are obtained via exiftool, this commit also refactors a bit our exfitool wrapper. --- libmat2/__init__.py | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) (limited to 'libmat2/__init__.py') diff --git a/libmat2/__init__.py b/libmat2/__init__.py index f55a14c..399a364 100644 --- a/libmat2/__init__.py +++ b/libmat2/__init__.py @@ -1,11 +1,12 @@ #!/usr/bin/env python3 -import os import collections import enum import importlib from typing import Dict, Optional +from . import exiftool, video + # make pyflakes happy assert Dict assert Optional @@ -37,24 +38,13 @@ DEPENDENCIES = { 'mutagen': 'Mutagen', } -def _get_exiftool_path() -> str: # pragma: no cover - exiftool_path = '/usr/bin/exiftool' - if os.path.isfile(exiftool_path): - if os.access(exiftool_path, os.X_OK): - return exiftool_path - - # ArchLinux - exiftool_path = '/usr/bin/vendor_perl/exiftool' - if os.path.isfile(exiftool_path): - if os.access(exiftool_path, os.X_OK): - return exiftool_path - raise ValueError def check_dependencies() -> dict: ret = collections.defaultdict(bool) # type: Dict[str, bool] - ret['Exiftool'] = True if _get_exiftool_path() else False + ret['Exiftool'] = True if exiftool._get_exiftool_path() else False + ret['Ffmpeg'] = True if video._get_ffmpeg_path() else False for key, value in DEPENDENCIES.items(): ret[value] = True -- cgit v1.3