@@ -274,10 +274,16 @@ |
||
| 274 | 274 | $this->output->writeln(count($facesFound).' faces(s) found.'); |
| 275 | 275 | } |
| 276 | 276 | |
| 277 | + /** |
|
| 278 | + * @param integer $progress |
|
| 279 | + */ |
|
| 277 | 280 | private function updateProgress($progress) { |
| 278 | 281 | $this->config->setAppValue('facerecognition', 'queue-done', $progress); |
| 279 | 282 | } |
| 280 | 283 | |
| 284 | + /** |
|
| 285 | + * @param integer $time |
|
| 286 | + */ |
|
| 281 | 287 | private function setStartTime($time) { |
| 282 | 288 | $this->config->setAppValue('facerecognition', 'starttime', $time); |
| 283 | 289 | } |
@@ -53,6 +53,9 @@ discard block |
||
| 53 | 53 | return $row ? (int)$row['id'] : null; |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | + /** |
|
| 57 | + * @param integer $model |
|
| 58 | + */ |
|
| 56 | 59 | public function countUserImages(string $userId, $model): int { |
| 57 | 60 | $qb = $this->db->getQueryBuilder(); |
| 58 | 61 | $query = $qb |
@@ -69,6 +72,9 @@ discard block |
||
| 69 | 72 | return (int)$data[0]; |
| 70 | 73 | } |
| 71 | 74 | |
| 75 | + /** |
|
| 76 | + * @param integer $model |
|
| 77 | + */ |
|
| 72 | 78 | public function countUserProcessedImages(string $userId, $model): int { |
| 73 | 79 | $qb = $this->db->getQueryBuilder(); |
| 74 | 80 | $query = $qb |
@@ -11,6 +11,11 @@ discard block |
||
| 11 | 11 | protected $model; |
| 12 | 12 | protected $fileList; |
| 13 | 13 | |
| 14 | + /** |
|
| 15 | + * @param string $command |
|
| 16 | + * @param string $predictor |
|
| 17 | + * @param string $model |
|
| 18 | + */ |
|
| 14 | 19 | function __construct($command, $predictor, $model) { |
| 15 | 20 | $this->command = $command; |
| 16 | 21 | $this->predictor = $predictor; |
@@ -18,6 +23,9 @@ discard block |
||
| 18 | 23 | $this->fileList = ""; |
| 19 | 24 | } |
| 20 | 25 | |
| 26 | + /** |
|
| 27 | + * @param string $filename |
|
| 28 | + */ |
|
| 21 | 29 | public function appendFile ($filename) |
| 22 | 30 | { |
| 23 | 31 | $this->fileList .= " ".escapeshellarg($filename); |
@@ -22,6 +22,9 @@ discard block |
||
| 22 | 22 | return $faces; |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | + /** |
|
| 26 | + * @param integer $model |
|
| 27 | + */ |
|
| 25 | 28 | public function countFaces(string $userId, $model): int { |
| 26 | 29 | $qb = $this->db->getQueryBuilder(); |
| 27 | 30 | $query = $qb |
@@ -39,6 +42,9 @@ discard block |
||
| 39 | 42 | return (int)$data[0]; |
| 40 | 43 | } |
| 41 | 44 | |
| 45 | + /** |
|
| 46 | + * @param integer $model |
|
| 47 | + */ |
|
| 42 | 48 | public function getFaces(string $userId, $model): array { |
| 43 | 49 | $qb = $this->db->getQueryBuilder(); |
| 44 | 50 | $query = $qb |
@@ -273,7 +273,7 @@ |
||
| 273 | 273 | * |
| 274 | 274 | * @param \FaceLandmarkDetection $fld Landmark detection model |
| 275 | 275 | * @param \FaceRecognition $fr Face recognition model |
| 276 | - * @param ImageProcessingContext Image processing context |
|
| 276 | + * @param ImageProcessingContext ImageProcessingContext processing context |
|
| 277 | 277 | */ |
| 278 | 278 | private function populateDescriptors(\FaceLandmarkDetection $fld, \FaceRecognition $fr, ImageProcessingContext $imageProcessingContext) { |
| 279 | 279 | $faces = $imageProcessingContext->getFaces(); |
@@ -22,16 +22,27 @@ discard block |
||
| 22 | 22 | return $this->findEntities($sql, [$userId]); |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | + /** |
|
| 26 | + * @param string $userId |
|
| 27 | + * @param integer $limit |
|
| 28 | + * @param integer $offset |
|
| 29 | + */ |
|
| 25 | 30 | public function findAllQueued($userId, $limit = null, $offset = null) { |
| 26 | 31 | $sql = 'SELECT * FROM *PREFIX*face_recognition WHERE uid = ? AND distance = -1 AND encoding IS NULL'; |
| 27 | 32 | return $this->findEntities($sql, [$userId], $limit, $offset); |
| 28 | 33 | } |
| 29 | 34 | |
| 35 | + /** |
|
| 36 | + * @param string $userId |
|
| 37 | + */ |
|
| 30 | 38 | public function findAllKnown($userId) { |
| 31 | 39 | $sql = 'SELECT * FROM *PREFIX*face_recognition WHERE uid = ? AND distance = 0 AND encoding IS NOT NULL'; |
| 32 | 40 | return $this->findEntities($sql, [$userId]); |
| 33 | 41 | } |
| 34 | 42 | |
| 43 | + /** |
|
| 44 | + * @param string $userId |
|
| 45 | + */ |
|
| 35 | 46 | public function findAllUnknown($userId) { |
| 36 | 47 | $sql = 'SELECT * FROM *PREFIX*face_recognition WHERE uid = ? AND distance > 0 AND encoding IS NOT NULL'; |
| 37 | 48 | return $this->findEntities($sql, [$userId]); |
@@ -42,6 +53,9 @@ discard block |
||
| 42 | 53 | return $this->findEntities($sql, [$userId]); |
| 43 | 54 | } |
| 44 | 55 | |
| 56 | + /** |
|
| 57 | + * @param integer $limit |
|
| 58 | + */ |
|
| 45 | 59 | public function findAllNamed($userId, $query, $limit = null, $offset = null) { |
| 46 | 60 | $sql = 'SELECT id, name, distance FROM *PREFIX*face_recognition WHERE uid = ? AND encoding IS NOT NULL AND LOWER(name) LIKE LOWER(?)'; |
| 47 | 61 | return $this->findEntities($sql, [$userId, $query], $limit, $offset); |
@@ -57,11 +71,17 @@ discard block |
||
| 57 | 71 | return $this->findEntities($sql, [$userId]); |
| 58 | 72 | } |
| 59 | 73 | |
| 74 | + /** |
|
| 75 | + * @param integer $fileId |
|
| 76 | + */ |
|
| 60 | 77 | public function findNewFile($userId, $fileId) { |
| 61 | 78 | $sql = 'SELECT * FROM *PREFIX*face_recognition WHERE uid = ? AND file = ? AND distance = -1 AND encoding IS NULL'; |
| 62 | 79 | return $this->findEntities($sql, [$userId, $fileId]); |
| 63 | 80 | } |
| 64 | 81 | |
| 82 | + /** |
|
| 83 | + * @param integer $fileId |
|
| 84 | + */ |
|
| 65 | 85 | public function findFile($userId, $fileId) { |
| 66 | 86 | $sql = 'SELECT * FROM *PREFIX*face_recognition WHERE uid = ? AND file = ?'; |
| 67 | 87 | return $this->findEntities($sql, [$userId, $fileId]); |
@@ -78,6 +98,9 @@ discard block |
||
| 78 | 98 | return true; |
| 79 | 99 | } |
| 80 | 100 | |
| 101 | + /** |
|
| 102 | + * @param string $userId |
|
| 103 | + */ |
|
| 81 | 104 | public function countUserQueue($userId) { |
| 82 | 105 | $sql = 'SELECT count(*) AS ct FROM *PREFIX*face_recognition WHERE uid = ? AND distance = -1 AND encoding IS NULL'; |
| 83 | 106 | $query = \OCP\DB::prepare($sql); |
@@ -82,6 +82,9 @@ |
||
| 82 | 82 | return $this->getFaceThumb ($fileId, $face); |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | + /** |
|
| 86 | + * @param \OCP\AppFramework\Db\Entity $face |
|
| 87 | + */ |
|
| 85 | 88 | private function getFaceThumb ($fileId, $face) { |
| 86 | 89 | $userFolder = $this->rootFolder->getUserFolder($this->userId); |
| 87 | 90 | $nodes = $userFolder->getById($fileId); |