Merge pull request #28523 from nextcloud/backport/28504/stable21

[stable21] Properly log errors in Movie previews generation
This commit is contained in:
John Molakvoæ 2021-08-19 23:27:25 +02:00 committed by GitHub
commit 13772b261e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View file

@ -224,6 +224,7 @@ class Generator {
$previewProviders = $this->previewManager->getProviders();
foreach ($previewProviders as $supportedMimeType => $providers) {
// Filter out providers that does not support this mime
if (!preg_match($supportedMimeType, $mimeType)) {
continue;
}

View file

@ -32,6 +32,7 @@ namespace OC\Preview;
use OCP\Files\File;
use OCP\IImage;
use Psr\Log\LoggerInterface;
class Movie extends ProviderV2 {
public static $avconvBinary;
@ -79,13 +80,13 @@ class Movie extends ProviderV2 {
$cmd = self::$avconvBinary . ' -y -ss ' . escapeshellarg($second) .
' -i ' . escapeshellarg($absPath) .
' -an -f mjpeg -vframes 1 -vsync 1 ' . escapeshellarg($tmpPath) .
' > /dev/null 2>&1';
' 2>&1';
} else {
$cmd = self::$ffmpegBinary . ' -y -ss ' . escapeshellarg($second) .
' -i ' . escapeshellarg($absPath) .
' -f mjpeg -vframes 1' .
' ' . escapeshellarg($tmpPath) .
' > /dev/null 2>&1';
' 2>&1';
}
exec($cmd, $output, $returnCode);
@ -100,6 +101,10 @@ class Movie extends ProviderV2 {
return $image;
}
}
$logger = \OC::$server->get(LoggerInterface::class);
$logger->error('Movie preview generation failed Output: {output}', ['app' => 'core', 'output' => $output]);
unlink($tmpPath);
return null;
}