From 35d2b54c8af09c4ff9a53f6f77d6714fccbb3282 Mon Sep 17 00:00:00 2001 From: Laurent Peuch Date: Wed, 4 May 2016 10:43:22 +0200 Subject: [PATCH] [enh] make ffmpeg dependancy recommanded --- prosopopee/prosopopee.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/prosopopee/prosopopee.py b/prosopopee/prosopopee.py index daf103d..6e9470a 100644 --- a/prosopopee/prosopopee.py +++ b/prosopopee/prosopopee.py @@ -52,6 +52,8 @@ class Video(object): return self.options["name"] def ffmpeg(self, source, target, options): + error(SETTINGS["ffmeg"], "I couldn't find a binary to convert video and I ask to do so, abort") + if not CACHE.needs_to_be_generated(source, target, options): okgreen("Skipped", source + " is already generated") return @@ -190,11 +192,14 @@ def main(): else: conv_video = "ffmpeg" - for i in ['gm', conv_video]: - if os.system("which " + i +" > /dev/null") != 0: - sys.stderr.write("ERROR: I can't locate the "+ i +" binary, " - "please install the '" + i + "' package.\n") - sys.exit(1) + error(os.system("which gm > /dev/null") == 0, "I can't locate the gm binary, " + "please install the 'graphicsmagick' package.\n") + + if os.system("which " + conv_video +" > /dev/null") != 0: + warning("I can't locate the "+ conv_video +" binary, " + "please install the '" + conv_video + "' package.\n") + warning("I won't be able to encode video and I will stop if I encounter a video to convert") + SETTINGS["ffmpeg"] = False error(os.path.exists(os.path.join(os.getcwd(), "settings.yaml")), "I can't find a " "settings.yaml in the current working directory")