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