Skip to content

Commit

Permalink
check if ffmpeg and ffprobe exists, addressing #18
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabian-Robert Stöter committed Jul 8, 2019
1 parent fc637d4 commit 2ba42ac
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion stempeg/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,29 @@
import soundfile as sf
import argparse
import pkg_resources
import shutil

__version__ = "0.1.6"
__version__ = "0.1.7"


def cmd_exist(cmd):
try:
from shutil import which
return shutil.which(cmd) is not None
except ImportError:
return any(
os.access(os.path.join(path, cmd), os.X_OK)
for path in os.environ["PATH"].split(os.pathsep)
)

def ffmpeg_and_ffprobe_exists():
return cmd_exist("ffmpeg") and cmd_exist("ffprobe")


if not ffmpeg_and_ffprobe_exists():
raise RuntimeError('ffmpeg or ffprobe could not be found! '
'Please install them before using stempeg. '
'See: https://github.com/faroit/stempeg')


def example_stem_path():
Expand Down

0 comments on commit 2ba42ac

Please sign in to comment.