From c92573e3dc2cdf091f2ae72516cab953cb4499b2 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Wed, 15 Jun 2016 19:32:53 +0200 Subject: [PATCH] Throw exception if required binary is not available --- controllers/FrontController.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/controllers/FrontController.php b/controllers/FrontController.php index 5efd34c..67681fd 100644 --- a/controllers/FrontController.php +++ b/controllers/FrontController.php @@ -124,6 +124,10 @@ class FrontController } catch (\Exception $e) { $video = $this->download->getJSON($params["url"], 'bestaudio/best'); + if (!shell_exec('which '.$this->config->avconv)) { + throw(new \Exception('Can\'t find avconv or ffmpeg')); + } + $avconvProc = ProcessBuilder::create( array( $this->config->avconv, @@ -156,6 +160,9 @@ class FrontController $response = $response->withHeader('Content-Type', 'audio/mpeg'); if (parse_url($video->url, PHP_URL_SCHEME) == 'rtmp') { + if (!shell_exec('which '.$this->config->rtmpdump)) { + throw(new \Exception('Can\'t find rtmpdump')); + } $builder = new ProcessBuilder( array( $this->config->rtmpdump, @@ -184,6 +191,9 @@ class FrontController $chain = new Chain($builder->getProcess()); $chain->add('|', $avconvProc); } else { + if (!shell_exec('which curl')) { + throw(new \Exception('Can\'t find curl')); + } $chain = new Chain( ProcessBuilder::create( array_merge(