index: prevent blank exif indexing
Signed-off-by: Varun Patil <radialapps@gmail.com>pull/839/head
parent
d773f36ed1
commit
697fc4535d
|
@ -123,9 +123,7 @@ class Index extends Command
|
|||
try {
|
||||
// Use static exiftool process
|
||||
\OCA\Memories\Exif::ensureStaticExiftoolProc();
|
||||
if (!Service\BinExt::testExiftool()) { // throws
|
||||
throw new \Exception('exiftool could not be executed or test failed');
|
||||
}
|
||||
Service\BinExt::testExiftool(); // throws
|
||||
|
||||
// Perform steps based on opts
|
||||
$this->checkClear();
|
||||
|
|
|
@ -25,6 +25,7 @@ namespace OCA\Memories\Command;
|
|||
|
||||
use OCA\Memories\Db\TimelineWrite;
|
||||
use OCA\Memories\Exif;
|
||||
use OCA\Memories\Service;
|
||||
use OCP\Files\File;
|
||||
use OCP\Files\Folder;
|
||||
use OCP\Files\IRootFolder;
|
||||
|
@ -111,6 +112,7 @@ class MigrateGoogleTakeout extends Command
|
|||
|
||||
// Start static exif process
|
||||
Exif::ensureStaticExiftoolProc();
|
||||
Service\BinExt::testExiftool(); // throws
|
||||
|
||||
// Call migration for each user
|
||||
if ($input->getOption('user')) {
|
||||
|
|
|
@ -59,13 +59,23 @@ class IndexJob extends TimedJob
|
|||
// Index with static exiftool process
|
||||
// This is sub-optimal: the process may not be required at all.
|
||||
try {
|
||||
// Start and make sure exiftool is working
|
||||
\OCA\Memories\Exif::ensureStaticExiftoolProc();
|
||||
Service\BinExt::testExiftool(); // throws
|
||||
|
||||
// Run the indexer
|
||||
$this->indexAllUsers();
|
||||
|
||||
// Remove stale index entries
|
||||
$this->service->cleanupStale();
|
||||
|
||||
$this->log('Indexing completed successfully', 'success');
|
||||
} catch (Service\ProcessClosedException $e) {
|
||||
$this->log('Indexing process stopped before completion. Will continue on next run', 'info');
|
||||
} catch (\Exception $e) {
|
||||
$this->log('Indexing exception: '.$e->getMessage());
|
||||
} finally {
|
||||
// Close the static exiftool process
|
||||
\OCA\Memories\Exif::closeStaticExiftoolProc();
|
||||
}
|
||||
|
||||
|
|
|
@ -91,10 +91,11 @@ class TimelineWrite
|
|||
}
|
||||
|
||||
// Get exif data
|
||||
try {
|
||||
$exif = Exif::getExifFromFile($file);
|
||||
} catch (\Exception $e) {
|
||||
$exif = [];
|
||||
|
||||
// Check if EXIF is blank, which is probably wrong
|
||||
if (0 === \count($exif)) {
|
||||
throw new \Exception('No EXIF data could be read: '.$file->getPath());
|
||||
}
|
||||
|
||||
// Hand off if Live Photo video part
|
||||
|
|
Loading…
Reference in New Issue