Skip to content

Commit 13772b2

Browse files
authored
Merge pull request #28523 from nextcloud/backport/28504/stable21
[stable21] Properly log errors in Movie previews generation
2 parents 160dfbb + ea37e69 commit 13772b2

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

lib/private/Preview/Generator.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ private function getMaxPreview(ISimpleFolder $previewFolder, File $file, $mimeTy
224224

225225
$previewProviders = $this->previewManager->getProviders();
226226
foreach ($previewProviders as $supportedMimeType => $providers) {
227+
// Filter out providers that does not support this mime
227228
if (!preg_match($supportedMimeType, $mimeType)) {
228229
continue;
229230
}

lib/private/Preview/Movie.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232

3333
use OCP\Files\File;
3434
use OCP\IImage;
35+
use Psr\Log\LoggerInterface;
3536

3637
class Movie extends ProviderV2 {
3738
public static $avconvBinary;
@@ -79,13 +80,13 @@ private function generateThumbNail($maxX, $maxY, $absPath, $second): ?IImage {
7980
$cmd = self::$avconvBinary . ' -y -ss ' . escapeshellarg($second) .
8081
' -i ' . escapeshellarg($absPath) .
8182
' -an -f mjpeg -vframes 1 -vsync 1 ' . escapeshellarg($tmpPath) .
82-
' > /dev/null 2>&1';
83+
' 2>&1';
8384
} else {
8485
$cmd = self::$ffmpegBinary . ' -y -ss ' . escapeshellarg($second) .
8586
' -i ' . escapeshellarg($absPath) .
8687
' -f mjpeg -vframes 1' .
8788
' ' . escapeshellarg($tmpPath) .
88-
' > /dev/null 2>&1';
89+
' 2>&1';
8990
}
9091

9192
exec($cmd, $output, $returnCode);
@@ -100,6 +101,10 @@ private function generateThumbNail($maxX, $maxY, $absPath, $second): ?IImage {
100101
return $image;
101102
}
102103
}
104+
105+
$logger = \OC::$server->get(LoggerInterface::class);
106+
$logger->error('Movie preview generation failed Output: {output}', ['app' => 'core', 'output' => $output]);
107+
103108
unlink($tmpPath);
104109
return null;
105110
}

0 commit comments

Comments
 (0)