Browse Source

Properly log errors in Movie previews generation

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
tags/v23.0.0beta1
John Molakvoæ (skjnldsv) 2 years ago
parent
commit
40c10ab145
No account linked to committer's email address
2 changed files with 8 additions and 2 deletions
  1. 1
    0
      lib/private/Preview/Generator.php
  2. 7
    2
      lib/private/Preview/Movie.php

+ 1
- 0
lib/private/Preview/Generator.php 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;
}

+ 7
- 2
lib/private/Preview/Movie.php 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;
}

Loading…
Cancel
Save