1- import sys
1+ from . exceptions import *
22from pathlib import Path
33import shutil
4- from . exceptions import *
4+ import sys
55
66# =========================================================================== #
77
88"""
9- Find exiftool executable
9+ Find dependency executable
1010
1111Returns:
12- Path to exiftool
12+ Path to dependency
1313
1414Raises:
15- DependencyError: If exiftool cannot be found
15+ DependencyError: If dependency cannot be found
1616"""
17- def find_exiftool ( ) -> str :
17+ def find_dependency ( dependency_str : str ) -> str :
1818
19- exe_name = "exiftool .exe" if sys .platform .startswith ("win" ) else "exiftool "
19+ exe_name = f" { dependency_str } .exe" if sys .platform .startswith ("win" ) else f" { dependency_str } "
2020
2121 # If bundle
2222 if getattr (sys , "frozen" , False ):
@@ -31,40 +31,9 @@ def find_exiftool() -> str:
3131 return system_path
3232
3333 raise DependencyError (
34- "Exiftool not found. Please install exiftool or use the provided bundled executable."
34+ f" { depency_str } not found. Please install { dependency_str } or use the provided bundled executable."
3535 "For further installation instructions, reference the README."
3636 )
3737
3838# =========================================================================== #
3939
40- """
41- Find ffmpeg executable.
42-
43- Returns:
44- Path to ffmpeg
45-
46- Raises:
47- DependencyError: If ffmpeg cannot be found
48- """
49- def find_ffmpeg () -> str :
50-
51- exe_name = "ffmpeg.exe" if sys .platform .startswith ("win" ) else "ffmpeg"
52-
53- # If bundle
54- if getattr (sys , "frozen" , False ):
55- base = Path (sys ._MEIPASS )
56- bundled = base / "bin" / exe_name
57- if bundled .exists ():
58- return str (bundled )
59-
60- # Try system PATH
61- system_path = shutil .which (exe_name )
62- if system_path :
63- return system_path
64-
65- raise DependencyError (
66- "FFMpeg not found. Please install ffmpeg or use the provided bundled executable."
67- "For further installation instructions, reference the README."
68- )
69-
70- # =========================================================================== #
0 commit comments