Skip to content

Commit a41c950

Browse files
authored
V0.3.8 maintenance (#212)
* Add new method of fileaction register (NC28) * v0.3.8 maintenance update and minor fixes Signed-off-by: Andrey Borysenko <[email protected]> * added ignoreOrientation option for collectorSettings Signed-off-by: Andrey Borysenko <[email protected]> * Revert "added ignoreOrientation option for collectorSettings" This reverts commit 7e787f9. * added ignoreOrientation global setting for collectorSettings Signed-off-by: Andrey Borysenko <[email protected]> * disable tests Signed-off-by: Andrey Borysenko <[email protected]> * update nextcloud npm packages Signed-off-by: Andrey Borysenko <[email protected]> * update changelog Signed-off-by: Andrey Borysenko <[email protected]> * update changelog Signed-off-by: Andrey Borysenko <[email protected]> * update badges Signed-off-by: Andrey Borysenko <[email protected]> * set nextcloud required version 28+ Signed-off-by: Andrey Borysenko <[email protected]> --------- Signed-off-by: Andrey Borysenko <[email protected]>
1 parent 5997939 commit a41c950

19 files changed

+2476
-11510
lines changed

.github/workflows/test.yml

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
name: Test
22

33
on:
4-
pull_request:
5-
branches:
6-
- main
7-
- dev
8-
paths-ignore:
9-
- l10n/**
10-
push:
11-
branches:
12-
- main
13-
- dev
14-
paths-ignore:
15-
- l10n/**
4+
# pull_request:
5+
# branches:
6+
# - main
7+
# - dev
8+
# paths-ignore:
9+
# - l10n/**
10+
# push:
11+
# branches:
12+
# - main
13+
# - dev
14+
# paths-ignore:
15+
# - l10n/**
1616
workflow_dispatch:
1717

1818
env:

CHANGELOG.md

+22
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,28 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [0.3.8 - 2023-12-14]
6+
7+
Maintenance update.
8+
[`cloud_py_api`](https://github.com/cloud-py-api/cloud_py_api) is **required** to be installed
9+
(or updated) and enabled first.
10+
11+
### Added
12+
13+
- Added task name of target folder for tasks created via file action
14+
- Added EXIF transpose option (https://github.com/cloud-py-api/mediadc/issues/199)
15+
16+
### Fixed
17+
18+
- Fixed duplicate task action does not copy task name
19+
- Fixed translatable strings for notification
20+
21+
### Updated
22+
23+
- Updated packages (security fixes, NC28 support)
24+
- Updated l10n (localization)
25+
- Update files plugin (NC28 support)
26+
527
## [0.3.7 - 2023-10-08]
628

729
Maintenance update.

README.md

-3
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22

33
![build](https://github.com/cloud-py-api/mediadc/actions/workflows/create-release-draft.yml/badge.svg)
44
[![Publish to Nextcloud app store](https://github.com/cloud-py-api/mediadc/actions/workflows/publish-appstore.yml/badge.svg)](https://github.com/cloud-py-api/mediadc/actions/workflows/publish-appstore.yml)
5-
[![Test](https://github.com/cloud-py-api/mediadc/actions/workflows/test.yml/badge.svg)](https://github.com/cloud-py-api/mediadc/actions/workflows/test.yml)
65
[![Test Binaries](https://github.com/cloud-py-api/mediadc/actions/workflows/test-binaries.yml/badge.svg)](https://github.com/cloud-py-api/mediadc/actions/workflows/test-binaries.yml)
7-
[![codecov](https://codecov.io/gh/andrey18106/mediadc/branch/main/graph/badge.svg?token=SCV4L0KDPV)](https://codecov.io/gh/andrey18106/mediadc)
8-
96
[![Github All Releases](https://img.shields.io/github/downloads/andrey18106/mediadc/total.svg)](https://github.com/cloud-py-api/mediadc/releases)
107

118
**📸📹 Collect photo and video duplicates to save your cloud storage space**

appinfo/info.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ This app allows to find duplicate or similar 📸📹 photos and videos
2020
Quick start guide and further information in our [Wiki](https://github.com/cloud-py-api/mediadc/wiki).
2121
]]>
2222
</description>
23-
<version>0.3.7</version>
23+
<version>0.3.8</version>
2424
<licence>agpl</licence>
2525
<author mail="[email protected]" homepage="https://github.com/andrey18106">Andrey Borysenko</author>
2626
<author mail="[email protected]" homepage="https://github.com/bigcat88">Alexander Piskun</author>
@@ -44,7 +44,7 @@ Quick start guide and further information in our [Wiki](https://github.com/cloud
4444
<screenshot>https://raw.githubusercontent.com/cloud-py-api/mediadc/main/screenshots/mediadc_filesplugin.png</screenshot>
4545
<dependencies>
4646
<php min-version="7.4" min-int-size="64" />
47-
<nextcloud min-version="25" max-version="28" />
47+
<nextcloud min-version="28" max-version="29" />
4848
</dependencies>
4949
<background-jobs>
5050
<job>OCA\MediaDC\BackgroundJob\CollectorCleanupJob</job>

lib/Command/CollectorTaskNotificationCommand.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ protected function configure(): void {
7474
protected function execute(InputInterface $input, OutputInterface $output): int {
7575
$taskId = $input->getArgument(self::ARGUMENT_TASK_ID);
7676
$status = $input->getArgument(self::ARGUMENT_TASK_STATUS);
77-
/** @var CollectorTask */
77+
/** @var CollectorTask $collectorTask */
7878
$collectorTask = $this->tasksMapper->find(intval($taskId));
7979
$detailGroups = array_map(function ($d) {
8080
$d['files'] = explode(',', $d['files']);
@@ -103,6 +103,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
103103
'status' => $status,
104104
'duplicate-groups' => count($detailGroups),
105105
'duplicates' => $duplicates,
106+
'name' => $collectorTask->getName(),
106107
]);
107108
$this->notificationManager->notify($notification);
108109
return 0;

lib/Migration/data/AppInitialData.php

+8
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@ class AppInitialData {
7171
"displayName" => "Use pre-compiled Python binaries",
7272
"description" => "Use Python part in binary format (located in the appdata folder)"
7373
],
74+
[
75+
"name" => "ignore_orientation",
76+
"value" => false,
77+
"displayName" => "Ignore EXIF image orientation",
78+
"description" => "Enable to allow detection of mirrored images as duplicates"
79+
],
7480
]
7581
];
7682

@@ -92,5 +98,7 @@ private function _stringsForL10N(): void {
9298
$this->l10n->t("Global administrator's exclude list that applies to each task");
9399
$this->l10n->t("Use pre-compiled Python binaries");
94100
$this->l10n->t("Use Python part in binary format (located in the appdata folder)");
101+
$this->l10n->t("Ignore EXIF image orientation");
102+
$this->l10n->t("Enable to allow detection of mirrored images as duplicates");
95103
}
96104
}

lib/Notification/Notifier.php

+9-2
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,16 @@ public function prepare(INotification $notification, string $languageCode): INot
6868

6969
$parameters = $notification->getSubjectParameters();
7070
if ($parameters['status'] === 'finished') {
71-
$notification->setRichSubject($l->t('Task successfully finished, found ' . $parameters['duplicate-groups'] . ' duplicate group(s) (' . $parameters['duplicates'] . ' file(s))'));
71+
if (isset($parameters['name']) && $parameters['name'] !== '') {
72+
$message = $l->t('Task "%s" successfully finished.', [$parameters['name']]);
73+
} else {
74+
$message = $l->t('Task successfully finished.');
75+
}
76+
$filesMessage = $l->n('%n file', '%n files', $parameters['duplicates']);
77+
$message .= ' ' . $l->n('Found %n duplicate group', 'Found %n duplicate groups', $parameters['duplicate-groups']) . ' (' . $filesMessage . ')';
78+
$notification->setRichSubject($message);
7279
} else {
73-
$notification->setRichSubject($l->t('Task finished with status "' . $parameters['status'] . '".'));
80+
$notification->setRichSubject($l->t('Task finished with status {status}', ['status' => $parameters['status']]));
7481
}
7582
$notification->setRichMessage($l->t('Task finished, check out results'));
7683
$notification->setParsedSubject($l->t('Task finished, check out results'));

lib/Service/CollectorService.php

+16-1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
use OCP\Files\IRootFolder;
3737
use OCP\AppFramework\Db\DoesNotExistException;
3838
use OCP\AppFramework\Db\MultipleObjectsReturnedException;
39+
use OCP\IL10N;
3940
use Psr\Log\LoggerInterface;
4041
use OCP\BackgroundJob\IJobList;
4142
use 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

Comments
 (0)