Skip to content
Closed
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
34 changes: 29 additions & 5 deletions lib/private/Preview/Movie.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,35 @@ public function getThumbnail(File $file, int $maxX, int $maxY): ?IImage {
if ($result === null) {
$result = $this->generateThumbNail($maxX, $maxY, $absPath, 0);
}
Server::get(LoggerInterface::class)->debug(
'Movie preview generation attempt failed'
. ', file=' . $file->getPath()
. ', time=' . $timeStamp
. ', size=' . ($size ?? 'entire file'),
['app' => 'core']
);
}

$this->cleanTmpFiles();

if ($result !== null) {
Server::get(LoggerInterface::class)->debug(
'Movie preview generation attempt success'
. ', file=' . $file->getPath()
. ', time=' . $timeStamp
. ', size=' . ($size ?? 'entire file'),
['app' => 'core']
);
break;
}

}
if ($result === null) {
Server::get(LoggerInterface::class)->error(
'Movie preview generation process failed'
. ', file=' . $file->getPath(),
['app' => 'core']
);
}

return $result;
Expand Down Expand Up @@ -167,21 +189,23 @@ private function generateThumbNail(int $maxX, int $maxY, string $absPath, int $s
$output = $stdout . $stderr;
}

Server::get(LoggerInterface::class)->debug(
'Movie preview generation output'
. ', file=' . $absPath
. ', output=',
['app' => 'core', 'output' => $output]
);

if ($returnCode === 0) {
$image = new \OCP\Image();
$image->loadFromFile($tmpPath);
if ($image->valid()) {
unlink($tmpPath);
$image->scaleDownToFit($maxX, $maxY);

return $image;
}
}

if ($second === 0) {
$logger = Server::get(LoggerInterface::class);
$logger->info('Movie preview generation failed Output: {output}', ['app' => 'core', 'output' => $output]);
}

unlink($tmpPath);
return null;
Expand Down