Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly log errors in Movie previews generation #28504

Merged
merged 1 commit into from
Aug 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/private/Preview/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ private function getMaxPreview(ISimpleFolder $previewFolder, File $file, $mimeTy

$previewProviders = $this->previewManager->getProviders();
foreach ($previewProviders as $supportedMimeType => $providers) {
// Filter out providers that does not support this mime
if (!preg_match($supportedMimeType, $mimeType)) {
continue;
}
Expand Down
9 changes: 7 additions & 2 deletions lib/private/Preview/Movie.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

use OCP\Files\File;
use OCP\IImage;
use Psr\Log\LoggerInterface;

class Movie extends ProviderV2 {
public static $avconvBinary;
Expand Down Expand Up @@ -78,13 +79,13 @@ private function generateThumbNail($maxX, $maxY, $absPath, $second): ?IImage {
$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);
Expand All @@ -99,6 +100,10 @@ private function generateThumbNail($maxX, $maxY, $absPath, $second): ?IImage {
return $image;
}
}

$logger = \OC::$server->get(LoggerInterface::class);
$logger->error('Movie preview generation failed Output: {output}', ['app' => 'core', 'output' => $output]);

unlink($tmpPath);
return null;
}
Expand Down