diff --git a/README.md b/README.md index df95676..5d370b7 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,9 @@ php artisan migrate php artisan queue:deploy-supervisor supervisorctl start all +# PDF Convertor +apt-get install poppler-utils + # Tesseract OCR add-apt-repository ppa:alex-p/tesseract-ocr-devel apt-get update diff --git a/app/Ingest/Convertor.php b/app/Ingest/Convertor.php index 641aa31..d6bbce7 100644 --- a/app/Ingest/Convertor.php +++ b/app/Ingest/Convertor.php @@ -203,11 +203,17 @@ class Convertor } } + \Illuminate\Support\Facades\Log::info('============================'); + \Illuminate\Support\Facades\Log::info($this->path); + // We are done with the images processing, delete directory. $this->storage->deleteDirectory($this->path); $this->path = "$this->path.md"; + \Illuminate\Support\Facades\Log::info($this->path); + \Illuminate\Support\Facades\Log::info('++++++++++++++++++++++++++'); + $this->storage->put($this->path, $imagesContent); } diff --git a/app/Jobs/IngestDocuments.php b/app/Jobs/IngestDocuments.php index 2af003a..7720ccb 100644 --- a/app/Jobs/IngestDocuments.php +++ b/app/Jobs/IngestDocuments.php @@ -78,7 +78,11 @@ class IngestDocuments implements ShouldQueue try { $this->path = $convertor->execute(); } catch (\Exception $exception) { + \Illuminate\Support\Facades\Log::info($exception->getMessage()); + $this->failed(); + + return; } // @TODO Replace later, the convertor will create the .md file. diff --git a/app/Jobs/SendToCore.php b/app/Jobs/SendToCore.php index e90d9fc..d1acd3e 100644 --- a/app/Jobs/SendToCore.php +++ b/app/Jobs/SendToCore.php @@ -73,6 +73,10 @@ class SendToCore implements ShouldQueue // if ($this->filePath && $sent) { if ($this->filePath) { + if ( ! $this->storage) { + $this->storage = Storage::disk('local'); + } + $this->storage->delete($this->filePath); } }