Properly log errors in Movie previews generation

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
John Molakvoæ (skjnldsv) 2021-08-19 09:45:50 +02:00
parent eb77a4b008
commit 40c10ab145
No known key found for this signature in database
GPG key ID: 60C25B8C072916CF
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

@ -31,6 +31,7 @@ namespace OC\Preview;
use OCP\Files\File;
use OCP\IImage;
use Psr\Log\LoggerInterface;
class Movie extends ProviderV2 {
public static $avconvBinary;
@ -78,13 +79,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);
@ -99,6 +100,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;
}