Merge branch 'master' into stable24

old_stable24 v3.7.0-alpha.2
Varun Patil 2022-11-09 06:33:31 -08:00
commit 3501bdf052
4 changed files with 29 additions and 9 deletions

View File

@ -33,7 +33,7 @@ Memories is a *batteries-included* photo management solution for Nextcloud with
1. Run `php ./occ memories:index` to generate metadata indices for existing photos.
1. Open the 📷 Memories app in Nextcloud and set the directory containing your photos.
]]></description>
<version>3.7.0-alpha.1</version>
<version>3.7.0-alpha.2</version>
<licence>agpl</licence>
<author mail="radialapps@gmail.com" >Varun Patil</author>
<namespace>Memories</namespace>

View File

@ -98,6 +98,7 @@ class VideoSetup extends Command
$goTranscodePath = realpath(__DIR__."/../../exiftool-bin/go-transcode-{$arch}-{$libc}");
$output->writeln("Trying go-transcode from {$goTranscodePath}");
chmod($goTranscodePath, 0755);
$goTranscode = shell_exec($goTranscodePath.' --help');
if (!$goTranscode || false === strpos($goTranscode, 'Available Commands')) {
@ -119,9 +120,7 @@ class VideoSetup extends Command
$output->writeln('');
$output->writeln('Do you want to enable transcoding and HLS? [Y/n]');
$handle = fopen('php://stdin', 'r');
$line = fgets($handle);
if ('n' === trim($line)) {
if ('n' === trim(fgets(fopen('php://stdin', 'r')))) {
$this->config->setSystemValue('memories.no_transcode', true);
$output->writeln('<error>Transcoding and HLS are now disabled</error>');
@ -135,6 +134,22 @@ class VideoSetup extends Command
$this->config->setSystemValue('memories.no_transcode', false);
$output->writeln('Transcoding and HLS are now enabled!');
// Check for VAAPI
$output->writeln("\nChecking for QSV (/dev/dri/renderD128)");
if (file_exists('/dev/dri/renderD128')) {
$output->writeln('QSV is available. Do you want to enable it? [Y/n]');
if ('n' === trim(fgets(fopen('php://stdin', 'r')))) {
$this->config->setSystemValue('memories.qsv', false);
$output->writeln('QSV is now disabled');
} else {
$this->config->setSystemValue('memories.qsv', true);
}
} else {
$output->writeln('QSV is not available');
$this->config->setSystemValue('memories.qsv', false);
}
return 0;
}
@ -149,9 +164,7 @@ class VideoSetup extends Command
{
$output->writeln('Without transcoding, video playback may be slow and limited');
$output->writeln('Do you want to disable transcoding and HLS streaming? [y/N]');
$handle = fopen('php://stdin', 'r');
$line = fgets($handle);
if ('y' !== trim($line)) {
if ('y' !== trim(fgets(fopen('php://stdin', 'r')))) {
$output->writeln('Aborting');
return 1;

View File

@ -89,11 +89,18 @@ class VideoController extends ApiBase
return new JSONResponse(['message' => 'Transcoder not configured'], Http::STATUS_INTERNAL_SERVER_ERROR);
}
// Check for environment variables
$vaapi = $this->config->getSystemValue('memories.qsv', false);
$env = '';
if ($vaapi) {
$env .= 'VAAPI=1 ';
}
// Check if already running
exec('ps a | grep go-transcode | grep -v grep', $procs);
if (0 === \count($procs)) {
shell_exec("mkdir -p {$tmpDir}/transcoder"); // php func has some weird problems
shell_exec("nohup {$transcoder} serve --config {$tConfig} > {$tmpDir}/transcoder/run.log 2>&1 & > /dev/null");
shell_exec("{$env} nohup {$transcoder} serve --config {$tConfig} > {$tmpDir}/transcoder/run.log 2>&1 & > /dev/null");
}
// wait for 2s and try again

View File

@ -17,7 +17,7 @@ mv "exiftool-$exifver" exiftool
rm -rf *.zip exiftool/t exiftool/html
chmod 755 exiftool/exiftool
gotranscode="v0.0.1"
gotranscode="v0.0.2"
wget -q "https://github.com/pulsejet/go-transcode/releases/download/$gotranscode/go-transcode-amd64-musl"
wget -q "https://github.com/pulsejet/go-transcode/releases/download/$gotranscode/go-transcode-amd64-glibc"
wget -q "https://github.com/pulsejet/go-transcode/releases/download/$gotranscode/go-transcode-aarch64-musl"