video: make go-vod port configurable (fix #354)

pull/391/head
Varun Patil 2023-01-31 19:56:41 -08:00
parent ecc6510713
commit eb9cd27d98
2 changed files with 15 additions and 13 deletions

View File

@ -225,26 +225,28 @@ class VideoController extends ApiBase
$env = []; $env = [];
// QSV with VAAPI // QSV with VAAPI
$vaapi = $this->config->getSystemValue('memories.qsv', false); if ($this->config->getSystemValue('memories.qsv', false)) {
if ($vaapi) { $env[] = 'VAAPI=1';
array_push($env, 'VAAPI=1');
} }
// NVENC // NVENC
$nvenc = $this->config->getSystemValue('memories.nvenc', false); if ($this->config->getSystemValue('memories.nvenc', false)) {
if ($nvenc) { $env[] = 'NVENC=1';
array_push($env, 'NVENC=1');
} }
// Bind address / port
$port = $this->config->getSystemValue('memories.govod_port', 47788);
$env[] = "GOVOD_BIND='127.0.0.1:{$port}'";
// Paths // Paths
$ffmpegPath = $this->config->getSystemValue('memories.ffmpeg_path', 'ffmpeg'); $ffmpegPath = $this->config->getSystemValue('memories.ffmpeg_path', 'ffmpeg');
$ffprobePath = $this->config->getSystemValue('memories.ffprobe_path', 'ffprobe'); $ffprobePath = $this->config->getSystemValue('memories.ffprobe_path', 'ffprobe');
array_push($env, "FFMPEG='{$ffmpegPath}'"); $env[] = "FFMPEG='{$ffmpegPath}'";
array_push($env, "FFPROBE='{$ffprobePath}'"); $env[] = "FFPROBE='{$ffprobePath}'";
// (Re-)create Temp dir // (Re-)create Temp dir
$instanceId = $this->config->getSystemValue('instanceid', 'default'); $instanceId = $this->config->getSystemValue('instanceid', 'default');
$defaultTmp = sys_get_temp_dir() . '/go-vod/' . $instanceId; $defaultTmp = sys_get_temp_dir().'/go-vod/'.$instanceId;
$tmpPath = $this->config->getSystemValue('memories.tmp_path', $defaultTmp); $tmpPath = $this->config->getSystemValue('memories.tmp_path', $defaultTmp);
shell_exec("rm -rf '{$tmpPath}'"); shell_exec("rm -rf '{$tmpPath}'");
mkdir($tmpPath, 0755, true); mkdir($tmpPath, 0755, true);
@ -253,8 +255,7 @@ class VideoController extends ApiBase
if ('/' === substr($tmpPath, -1)) { if ('/' === substr($tmpPath, -1)) {
$tmpPath = substr($tmpPath, 0, -1); $tmpPath = substr($tmpPath, 0, -1);
} }
$env[] = "GOVOD_TEMPDIR='{$tmpPath}'";
array_push($env, "GOVOD_TEMPDIR='{$tmpPath}'");
// Kill already running and start new // Kill already running and start new
\OCA\Memories\Util::pkill($transcoder); \OCA\Memories\Util::pkill($transcoder);
@ -273,7 +274,8 @@ class VideoController extends ApiBase
// Make sure query params are repeated // Make sure query params are repeated
// For example, in folder sharing, we need the params on every request // For example, in folder sharing, we need the params on every request
$url = "http://127.0.0.1:47788/{$client}{$path}/{$profile}"; $port = $this->config->getSystemValue('memories.govod_port', 47788);
$url = "http://127.0.0.1:{$port}/{$client}{$path}/{$profile}";
if ($params = $_SERVER['QUERY_STRING']) { if ($params = $_SERVER['QUERY_STRING']) {
$url .= "?{$params}"; $url .= "?{$params}";
} }

View File

@ -20,7 +20,7 @@ mv "exiftool-$exifver" exiftool
rm -rf *.zip exiftool/t exiftool/html rm -rf *.zip exiftool/t exiftool/html
chmod 755 exiftool/exiftool chmod 755 exiftool/exiftool
govod="0.0.24" govod="0.0.25"
echo "Getting go-vod $govod" echo "Getting go-vod $govod"
wget -q "https://github.com/pulsejet/go-vod/releases/download/$govod/go-vod-amd64" wget -q "https://github.com/pulsejet/go-vod/releases/download/$govod/go-vod-amd64"
wget -q "https://github.com/pulsejet/go-vod/releases/download/$govod/go-vod-aarch64" wget -q "https://github.com/pulsejet/go-vod/releases/download/$govod/go-vod-aarch64"