-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Feature/impl#144 (#145) * Register EventService class * Fire TextRecognizedEvent * Add TextRecognizedEvent class * Create sidecar and add recognized text to result * Added PdfOcrProcessor constructor argument * Added recognizedText variable to class * Added EventService * Refactored TextRecognizeEvent * Added EventService * Fixed tests * composer run cs:fix * Basic code cleanup Signed-off-by: Robin Windey <ro.windey@gmail.com> * Adjustments for #144 * Add additional tests * Refactor code to use more "high-level" SidecarFileAccessor Signed-off-by: Robin Windey <ro.windey@gmail.com> * Add docs for #144 * Add section for events to README.md * Remove TOC workflow Signed-off-by: Robin Windey <ro.windey@gmail.com> * Fix php7.4 syntax Signed-off-by: Robin Windey <ro.windey@gmail.com> * Add check if event is emitted Signed-off-by: Robin Windey <ro.windey@gmail.com> * Change TextRecognizedEvent interface to be more generic Linked to #144 * Adjust docs to match new interface Signed-off-by: Robin Windey <ro.windey@gmail.com> * Fix codecov Signed-off-by: Robin Windey <ro.windey@gmail.com> Signed-off-by: Robin Windey <ro.windey@gmail.com> Co-authored-by: Guido Schmitz <g.schmitz@iurfriend.com> Co-authored-by: Robin Windey <ro.windey@gmail.com> * Implement #140 (#148) * Implement #140 Get installed tesseract languages from backend Signed-off-by: Robin Windey <ro.windey@gmail.com> * Fix OcrBackendInfoServiceTest for #140 Signed-off-by: Robin Windey <ro.windey@gmail.com> * Introduce specific CommandException Signed-off-by: Robin Windey <ro.windey@gmail.com> Signed-off-by: Robin Windey <ro.windey@gmail.com> Signed-off-by: Robin Windey <ro.windey@gmail.com> Co-authored-by: g-schmitz <g.schmitz@addedlifevalue.com> Co-authored-by: Guido Schmitz <g.schmitz@iurfriend.com>
- Loading branch information
1 parent
d89d43a
commit cf9a9ec
Showing
41 changed files
with
1,601 additions
and
166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* @copyright Copyright (c) 2022 Robin Windey <ro.windey@gmail.com> | ||
* | ||
* @author Robin Windey <ro.windey@gmail.com> | ||
* | ||
* @license GNU AGPL version 3 or any later version | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as | ||
* published by the Free Software Foundation, either version 3 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
namespace OCA\WorkflowOcr\Controller; | ||
|
||
use OCP\AppFramework\Controller; | ||
use OCP\AppFramework\Http\JSONResponse; | ||
|
||
abstract class ControllerBase extends Controller { | ||
protected function tryExecute(callable $function) : JSONResponse { | ||
try { | ||
$result = $function(); | ||
return new JSONResponse($result); | ||
} catch (\Throwable $e) { | ||
return new JSONResponse(['error' => $e->getMessage()], 500); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* @copyright Copyright (c) 2022 Robin Windey <ro.windey@gmail.com> | ||
* | ||
* @author Robin Windey <ro.windey@gmail.com> | ||
* | ||
* @license GNU AGPL version 3 or any later version | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as | ||
* published by the Free Software Foundation, either version 3 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
namespace OCA\WorkflowOcr\Controller; | ||
|
||
use OCA\WorkflowOcr\Service\IOcrBackendInfoService; | ||
use OCP\AppFramework\Http\JSONResponse; | ||
use OCP\IRequest; | ||
|
||
/** | ||
* This is the backend API controller which provides informations about the OCR backend system. | ||
*/ | ||
class OcrBackendInfoController extends ControllerBase { | ||
/** @var IOcrBackendInfoService */ | ||
private $ocrBackendInfoService; | ||
|
||
public function __construct($AppName, IRequest $request, IOcrBackendInfoService $ocrBackendInfoService) { | ||
parent::__construct($AppName, $request); | ||
$this->ocrBackendInfoService = $ocrBackendInfoService; | ||
} | ||
|
||
/** | ||
* @return JSONResponse | ||
*/ | ||
public function getInstalledLanguages() : JSONResponse { | ||
return $this->tryExecute(function () { | ||
return $this->ocrBackendInfoService->getInstalledLanguages(); | ||
}); | ||
} | ||
} |
Oops, something went wrong.