3636use OCP \Files \IRootFolder ;
3737use OCP \AppFramework \Db \DoesNotExistException ;
3838use OCP \AppFramework \Db \MultipleObjectsReturnedException ;
39+ use OCP \IL10N ;
3940use Psr \Log \LoggerInterface ;
4041use OCP \BackgroundJob \IJobList ;
4142use OCP \Files \NotFoundException ;
@@ -99,6 +100,7 @@ class CollectorService {
99100 public const TASK_TYPE_MANUAL = 'manual ' ;
100101 public const TASK_TYPE_AUTO = 'auto ' ;
101102 public const TASK_TYPE_QUEUED = 'queued ' ;
103+ private IL10N $ l10n ;
102104
103105
104106 public function __construct (
@@ -113,7 +115,8 @@ public function __construct(
113115 VideosService $ videosService ,
114116 IJobList $ jobList ,
115117 IPreview $ previewManager ,
116- CPAUtilsService $ cpaUtils
118+ CPAUtilsService $ cpaUtils ,
119+ IL10N $ l10n ,
117120 ) {
118121 if ($ userId !== null ) {
119122 $ this ->userId = $ userId ;
@@ -129,6 +132,7 @@ public function __construct(
129132 $ this ->videosService = $ videosService ;
130133 $ this ->jobList = $ jobList ;
131134 $ this ->previewManager = $ previewManager ;
135+ $ this ->l10n = $ l10n ;
132136 }
133137
134138 /**
@@ -228,6 +232,10 @@ public function restartTask(array $params = []) {
228232 $ this ->terminate ($ taskId );
229233
230234 if ($ taskData ['files_total ' ] > 0 ) {
235+ if (!isset ($ collectorSettings ['exif_transpose ' ])) {
236+ $ ignoreOrientationSetting = $ this ->settingsMapper ->findByName ('ignore_orientation ' );
237+ $ collectorSettings ['exif_transpose ' ] = !json_decode ($ ignoreOrientationSetting ->getValue ());
238+ }
231239 $ collectorTask ->setTargetDirectoryIds (json_encode ($ targetDirectoryIds ));
232240 $ collectorTask ->setExcludeList (json_encode ($ excludeList ));
233241 $ collectorTask ->setCollectorSettings (json_encode ($ collectorSettings ));
@@ -342,8 +350,10 @@ public function duplicate($taskId): ?CollectorTask {
342350 'hash_size ' => $ collectorSettings ['hash_size ' ],
343351 'target_mtype ' => $ collectorSettings ['target_mtype ' ],
344352 'finish_notification ' => $ collectorSettings ['finish_notification ' ],
353+ 'exif_transpose ' => $ collectorSettings ['exif_transpose ' ] ?? true ,
345354 ],
346355 'excludeList ' => json_decode ($ collectorTask ->getExcludeList (), true ),
356+ 'name ' => '[ ' . $ this ->l10n ->t ('duplicated ' ) . '] ' . $ collectorTask ->getName (),
347357 ]);
348358 return $ duplicatedCollectorTask ;
349359 }
@@ -362,6 +372,8 @@ public function createCollectorTask(array $params = [], bool $queued = false): ?
362372 $ pyThresholdSetting = $ this ->settingsMapper ->findByName ('similarity_threshold ' );
363373 /** @var Setting */
364374 $ pyHashSizeSetting = $ this ->settingsMapper ->findByName ('hash_size ' );
375+ /** @var Setting */
376+ $ ignoreOrientationSetting = $ this ->settingsMapper ->findByName ('ignore_orientation ' );
365377 } else {
366378 /** @var string */
367379 $ pyAlgorithmSetting = $ params ['collectorSettings ' ]['hashing_algorithm ' ];
@@ -370,6 +382,8 @@ public function createCollectorTask(array $params = [], bool $queued = false): ?
370382 /** @var string */
371383 $ pyHashSizeSetting = $ params ['collectorSettings ' ]['hash_size ' ];
372384 /** @var Setting */
385+ $ ignoreOrientationSetting = $ this ->settingsMapper ->findByName ('ignore_orientation ' );
386+ /** @var Setting */
373387 $ excludeListSetting = $ this ->settingsMapper ->findByName ('exclude_list ' );
374388 $ excludeList = count ($ params ) === 0 ? [
375389 'admin ' => $ excludeListSetting ->getValue (),
@@ -404,6 +418,7 @@ public function createCollectorTask(array $params = [], bool $queued = false): ?
404418 'finish_notification ' => count ($ params ) === 0
405419 ? true : $ params ['collectorSettings ' ]['finish_notification ' ],
406420 'duplicated ' => isset ($ params ['type ' ]) && $ params ['type ' ] === 'duplicated ' ,
421+ 'exif_transpose ' => count ($ params ) === 0 ? $ ignoreOrientationSetting ->getValue () : $ params ['collectorSettings ' ]['exif_transpose ' ],
407422 ]),
408423 'filesScanned ' => 0 ,
409424 'filesTotal ' => count ($ params ) === 0
0 commit comments