@@ -50,7 +50,6 @@ |
||
50 | 50 | /** |
51 | 51 | * @NoAdminRequired |
52 | 52 | * |
53 | - * @param string $oldName |
|
54 | 53 | * @param string $newName |
55 | 54 | */ |
56 | 55 | public function updateName($name, $newName) { |
@@ -3,16 +3,9 @@ |
||
3 | 3 | |
4 | 4 | use OCP\IRequest; |
5 | 5 | use OCP\Files\IRootFolder; |
6 | -use OCP\AppFramework\Http; |
|
7 | 6 | use OCP\AppFramework\Http\DataResponse; |
8 | -use OCP\AppFramework\Http\JSONResponse; |
|
9 | -use OCP\AppFramework\Http\DataDisplayResponse; |
|
10 | 7 | use OCP\AppFramework\Controller; |
11 | - |
|
12 | -use OCA\FaceRecognition\Db\Face; |
|
13 | 8 | use OCA\FaceRecognition\Db\FaceMapper; |
14 | - |
|
15 | -use OCA\FaceRecognition\Db\Person; |
|
16 | 9 | use OCA\FaceRecognition\Db\PersonMapper; |
17 | 10 | |
18 | 11 | class PersonController extends Controller { |
@@ -3,8 +3,6 @@ |
||
3 | 3 | |
4 | 4 | use OCP\IDBConnection; |
5 | 5 | use OCP\AppFramework\Db\Mapper; |
6 | -use OCP\AppFramework\Db\DoesNotExistException; |
|
7 | -use OCP\DB\QueryBuilder\IQueryBuilder; |
|
8 | 6 | |
9 | 7 | class FaceMapper extends Mapper { |
10 | 8 |
@@ -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); |
@@ -24,7 +24,6 @@ |
||
24 | 24 | namespace OCA\FaceRecognition\Db; |
25 | 25 | |
26 | 26 | use JsonSerializable; |
27 | - |
|
28 | 27 | use OCP\AppFramework\Db\Entity; |
29 | 28 | |
30 | 29 | /** |
@@ -3,7 +3,6 @@ |
||
3 | 3 | |
4 | 4 | use OCP\IDBConnection; |
5 | 5 | use OCP\AppFramework\Db\Mapper; |
6 | -use OCP\AppFramework\Db\DoesNotExistException; |
|
7 | 6 | use OCP\DB\QueryBuilder\IQueryBuilder; |
8 | 7 | |
9 | 8 | class FaceNewMapper extends Mapper { |
@@ -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 |
@@ -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 |
@@ -25,9 +25,7 @@ |
||
25 | 25 | |
26 | 26 | use OCP\IDBConnection; |
27 | 27 | use OCP\IUser; |
28 | - |
|
29 | 28 | use OCP\AppFramework\Db\Mapper; |
30 | -use OCP\AppFramework\Db\DoesNotExistException; |
|
31 | 29 | use OCP\DB\QueryBuilder\IQueryBuilder; |
32 | 30 | |
33 | 31 | class ImageMapper extends Mapper { |
@@ -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); |
@@ -2,8 +2,6 @@ |
||
2 | 2 | |
3 | 3 | namespace OCA\FaceRecognition\Helper; |
4 | 4 | |
5 | -use OCP\App\IAppManager; |
|
6 | - |
|
7 | 5 | class PythonAnalyzer |
8 | 6 | { |
9 | 7 | protected $command; |
@@ -124,7 +124,7 @@ |
||
124 | 124 | * Based on that and the fact that Nextcloud is superset of these, these are supported image types. |
125 | 125 | * |
126 | 126 | * @param string $mimeType MIME type to check if it supported |
127 | - * @return true if MIME type is supported, false otherwise |
|
127 | + * @return boolean if MIME type is supported, false otherwise |
|
128 | 128 | */ |
129 | 129 | public static function isImageTypeSupported(string $mimeType): bool { |
130 | 130 | if ( |
@@ -31,7 +31,6 @@ |
||
31 | 31 | use OCP\IDBConnection; |
32 | 32 | use OCP\ILogger; |
33 | 33 | use OCP\IUserManager; |
34 | - |
|
35 | 34 | use OCA\FaceRecognition\BackgroundJob\Tasks\AddMissingImagesTask; |
36 | 35 | use OCA\FaceRecognition\Db\Face; |
37 | 36 | use OCA\FaceRecognition\Db\Image; |
@@ -5,17 +5,10 @@ |
||
5 | 5 | use OCP\Files\IRootFolder; |
6 | 6 | use OCP\AppFramework\Http; |
7 | 7 | use OCP\AppFramework\Http\DataResponse; |
8 | -use OCP\AppFramework\Http\JSONResponse; |
|
9 | 8 | use OCP\AppFramework\Http\DataDisplayResponse; |
10 | 9 | use OCP\AppFramework\Controller; |
11 | - |
|
12 | -use OCA\FaceRecognition\Db\Face; |
|
13 | 10 | use OCA\FaceRecognition\Db\FaceMapper; |
14 | - |
|
15 | -use OCA\FaceRecognition\Db\FaceNew; |
|
16 | 11 | use OCA\FaceRecognition\Db\FaceNewMapper; |
17 | - |
|
18 | -use OCA\FaceRecognition\Db\Image; |
|
19 | 12 | use OCA\FaceRecognition\Db\ImageMapper; |
20 | 13 | |
21 | 14 | class FaceController extends Controller { |
@@ -82,6 +82,9 @@ discard block |
||
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); |
@@ -141,7 +144,7 @@ discard block |
||
141 | 144 | * @NoAdminRequired |
142 | 145 | * |
143 | 146 | * @param int $id |
144 | - * @param string $name |
|
147 | + * @param string $newName |
|
145 | 148 | */ |
146 | 149 | public function updateName ($id, $newName) { |
147 | 150 | $face = $this->faceMapper->find($id, $this->userId); |