diff --git a/lib/private/Preview/Movie.php b/lib/private/Preview/Movie.php index 6f0b0d70497e2..91857effbe1e0 100644 --- a/lib/private/Preview/Movie.php +++ b/lib/private/Preview/Movie.php @@ -100,13 +100,35 @@ public function getThumbnail(File $file, int $maxX, int $maxY): ?IImage { if ($result !== null) { break; } + 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; } @@ -128,7 +150,7 @@ private function getSparseFile(File $file, int $size): string|false { $absPath = Server::get(ITempManager::class)->getTemporaryFile(); if ($absPath === false) { Server::get(LoggerInterface::class)->error( - 'Failed to get sparse file to generate thumbnail: ' . $file->getPath(), + 'Failed to get temp file to create sparse file to generate thumbnail: ' . $file->getPath(), ['app' => 'core'] ); fclose($content); @@ -214,6 +236,10 @@ private function getSparseFile(File $file, int $size): string|false { } fclose($content); fclose($sparseFile); + Server::get(LoggerInterface::class)->debug( + 'Sparse file being utilized for preview generation for ' . $file->getPath(), + ['app' => 'core'] + ); return $absPath; } @@ -287,21 +313,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;