diff --git a/lib/BinExt.php b/lib/BinExt.php index 9e79e305..b25475c6 100644 --- a/lib/BinExt.php +++ b/lib/BinExt.php @@ -152,6 +152,14 @@ class BinExt ]); } + /** + * Get temp binary for go-vod. + */ + public static function getGoVodBin() + { + return self::getTempBin(Util::getSystemConfig('memories.vod.path'), 'go-vod-'.self::GOVOD_VER); + } + /** * If local, restart the go-vod instance. * If external, configure the go-vod instance. @@ -166,24 +174,11 @@ class BinExt } // Get transcoder path - $transcoder = self::getTempBin(Util::getSystemConfig('memories.vod.path'), 'go-vod-'.self::GOVOD_VER); + $transcoder = self::getGoVodBin(); if (empty($transcoder)) { throw new \Exception('Transcoder not configured'); } - // Make sure transcoder exists - if (!file_exists($transcoder)) { - throw new \Exception("Transcoder not found; ({$transcoder})"); - } - - // Make transcoder executable - if (!is_executable($transcoder)) { - @chmod($transcoder, 0755); - if (!is_executable($transcoder)) { - throw new \Exception("Transcoder not executable (chmod 755 {$transcoder})"); - } - } - // Get local config $env = self::getGoVodConfig(true); $tmpPath = $env['tempdir']; diff --git a/lib/Controller/OtherController.php b/lib/Controller/OtherController.php index d7dea800..8539decc 100644 --- a/lib/Controller/OtherController.php +++ b/lib/Controller/OtherController.php @@ -133,14 +133,15 @@ class OtherController extends GenericApiController $status['ffprobe'] = $this->getExecutableStatus(Util::getSystemConfig('memories.vod.ffprobe')); // Check go-vod binary - $status['govod'] = $this->getExecutableStatus(Util::getSystemConfig('memories.vod.path')); - if ('ok' === $status['govod'] || Util::getSystemConfig('memories.vod.external')) { - try { + try { + $s = $this->getExecutableStatus(BinExt::getGoVodBin()); + if ('ok' === $s || Util::getSystemConfig('memories.vod.external')) { BinExt::testStartGoVod(); - $status['govod'] = 'test_ok'; - } catch (\Exception $e) { - $status['govod'] = 'test_fail:'.$e->getMessage(); + $s = 'test_ok'; } + $status['govod'] = $s; + } catch (\Exception $e) { + $status['govod'] = 'test_fail:'.$e->getMessage(); } // Check for VA-API device