diff options
Diffstat (limited to 'libmat2/exiftool.py')
| -rw-r--r-- | libmat2/exiftool.py | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/libmat2/exiftool.py b/libmat2/exiftool.py index 1ce60a1..eb65b2a 100644 --- a/libmat2/exiftool.py +++ b/libmat2/exiftool.py | |||
| @@ -2,6 +2,7 @@ import functools | |||
| 2 | import json | 2 | import json |
| 3 | import logging | 3 | import logging |
| 4 | import os | 4 | import os |
| 5 | import shutil | ||
| 5 | import subprocess | 6 | import subprocess |
| 6 | from typing import Dict, Union, Set | 7 | from typing import Dict, Union, Set |
| 7 | 8 | ||
| @@ -71,14 +72,12 @@ class ExiftoolParser(abstract.AbstractParser): | |||
| 71 | 72 | ||
| 72 | @functools.lru_cache() | 73 | @functools.lru_cache() |
| 73 | def _get_exiftool_path() -> str: # pragma: no cover | 74 | def _get_exiftool_path() -> str: # pragma: no cover |
| 74 | possible_pathes = { | 75 | which_path = shutil.which('exiftool') |
| 75 | '/usr/bin/exiftool', # debian/fedora | 76 | if which_path: |
| 76 | '/usr/bin/vendor_perl/exiftool', # archlinux | 77 | return which_path |
| 77 | } | ||
| 78 | 78 | ||
| 79 | for possible_path in possible_pathes: | 79 | # Exiftool on Arch Linux has a weird path |
| 80 | if os.path.isfile(possible_path): | 80 | if os.access('/usr/bin/vendor_perl/exiftool', os.X_OK): |
| 81 | if os.access(possible_path, os.X_OK): | 81 | return '/usr/bin/vendor_perl/exiftool' |
| 82 | return possible_path | ||
| 83 | 82 | ||
| 84 | raise RuntimeError("Unable to find exiftool") | 83 | raise RuntimeError("Unable to find exiftool") |
