diff options
Diffstat (limited to 'libmat2/__init__.py')
| -rw-r--r-- | libmat2/__init__.py | 18 |
1 files changed, 4 insertions, 14 deletions
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 @@ | |||
| 1 | #!/usr/bin/env python3 | 1 | #!/usr/bin/env python3 |
| 2 | 2 | ||
| 3 | import os | ||
| 4 | import collections | 3 | import collections |
| 5 | import enum | 4 | import enum |
| 6 | import importlib | 5 | import importlib |
| 7 | from typing import Dict, Optional | 6 | from typing import Dict, Optional |
| 8 | 7 | ||
| 8 | from . import exiftool, video | ||
| 9 | |||
| 9 | # make pyflakes happy | 10 | # make pyflakes happy |
| 10 | assert Dict | 11 | assert Dict |
| 11 | assert Optional | 12 | assert Optional |
| @@ -37,24 +38,13 @@ DEPENDENCIES = { | |||
| 37 | 'mutagen': 'Mutagen', | 38 | 'mutagen': 'Mutagen', |
| 38 | } | 39 | } |
| 39 | 40 | ||
| 40 | def _get_exiftool_path() -> str: # pragma: no cover | ||
| 41 | exiftool_path = '/usr/bin/exiftool' | ||
| 42 | if os.path.isfile(exiftool_path): | ||
| 43 | if os.access(exiftool_path, os.X_OK): | ||
| 44 | return exiftool_path | ||
| 45 | |||
| 46 | # ArchLinux | ||
| 47 | exiftool_path = '/usr/bin/vendor_perl/exiftool' | ||
| 48 | if os.path.isfile(exiftool_path): | ||
| 49 | if os.access(exiftool_path, os.X_OK): | ||
| 50 | return exiftool_path | ||
| 51 | 41 | ||
| 52 | raise ValueError | ||
| 53 | 42 | ||
| 54 | def check_dependencies() -> dict: | 43 | def check_dependencies() -> dict: |
| 55 | ret = collections.defaultdict(bool) # type: Dict[str, bool] | 44 | ret = collections.defaultdict(bool) # type: Dict[str, bool] |
| 56 | 45 | ||
| 57 | ret['Exiftool'] = True if _get_exiftool_path() else False | 46 | ret['Exiftool'] = True if exiftool._get_exiftool_path() else False |
| 47 | ret['Ffmpeg'] = True if video._get_ffmpeg_path() else False | ||
| 58 | 48 | ||
| 59 | for key, value in DEPENDENCIES.items(): | 49 | for key, value in DEPENDENCIES.items(): |
| 60 | ret[value] = True | 50 | ret[value] = True |
