Properly log errors in Movie previews generation

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
pull/28504/head
John Molakvoæ (skjnldsv) 5 years ago
parent eb77a4b008
commit 40c10ab145
No known key found for this signature in database
GPG Key ID: 60C25B8C072916CF
  1. 1
      lib/private/Preview/Generator.php
  2. 9
      lib/private/Preview/Movie.php

@ -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;
}

@ -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;
}

Loading…
Cancel
Save