Skip to content

Commit

Permalink
V0.3.8 maintenance (#212)
Browse files Browse the repository at this point in the history
* Add new method of fileaction register (NC28)

* v0.3.8 maintenance update and minor fixes

Signed-off-by: Andrey Borysenko <andrey18106x@gmail.com>

* added ignoreOrientation option for collectorSettings

Signed-off-by: Andrey Borysenko <andrey18106x@gmail.com>

* Revert "added ignoreOrientation option for collectorSettings"

This reverts commit 7e787f9.

* added ignoreOrientation global setting for collectorSettings

Signed-off-by: Andrey Borysenko <andrey18106x@gmail.com>

* disable tests

Signed-off-by: Andrey Borysenko <andrey18106x@gmail.com>

* update nextcloud npm packages

Signed-off-by: Andrey Borysenko <andrey18106x@gmail.com>

* update changelog

Signed-off-by: Andrey Borysenko <andrey18106x@gmail.com>

* update changelog

Signed-off-by: Andrey Borysenko <andrey18106x@gmail.com>

* update badges

Signed-off-by: Andrey Borysenko <andrey18106x@gmail.com>

* set nextcloud required version 28+

Signed-off-by: Andrey Borysenko <andrey18106x@gmail.com>

---------

Signed-off-by: Andrey Borysenko <andrey18106x@gmail.com>
  • Loading branch information
andrey18106 committed Dec 14, 2023
1 parent 5997939 commit a41c950
Show file tree
Hide file tree
Showing 19 changed files with 2,476 additions and 11,510 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
name: Test

on:
pull_request:
branches:
- main
- dev
paths-ignore:
- l10n/**
push:
branches:
- main
- dev
paths-ignore:
- l10n/**
# pull_request:
# branches:
# - main
# - dev
# paths-ignore:
# - l10n/**
# push:
# branches:
# - main
# - dev
# paths-ignore:
# - l10n/**
workflow_dispatch:

env:
Expand Down
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,28 @@

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

## [0.3.8 - 2023-12-14]

Maintenance update.
[`cloud_py_api`](https://github.com/cloud-py-api/cloud_py_api) is **required** to be installed
(or updated) and enabled first.

### Added

- Added task name of target folder for tasks created via file action
- Added EXIF transpose option (https://github.com/cloud-py-api/mediadc/issues/199)

### Fixed

- Fixed duplicate task action does not copy task name
- Fixed translatable strings for notification

### Updated

- Updated packages (security fixes, NC28 support)
- Updated l10n (localization)
- Update files plugin (NC28 support)

## [0.3.7 - 2023-10-08]

Maintenance update.
Expand Down
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@

![build](https://github.com/cloud-py-api/mediadc/actions/workflows/create-release-draft.yml/badge.svg)
[![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)
[![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)
[![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)
[![codecov](https://codecov.io/gh/andrey18106/mediadc/branch/main/graph/badge.svg?token=SCV4L0KDPV)](https://codecov.io/gh/andrey18106/mediadc)

[![Github All Releases](https://img.shields.io/github/downloads/andrey18106/mediadc/total.svg)](https://github.com/cloud-py-api/mediadc/releases)

**📸📹 Collect photo and video duplicates to save your cloud storage space**
Expand Down
4 changes: 2 additions & 2 deletions appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ This app allows to find duplicate or similar 📸📹 photos and videos
Quick start guide and further information in our [Wiki](https://github.com/cloud-py-api/mediadc/wiki).
]]>
</description>
<version>0.3.7</version>
<version>0.3.8</version>
<licence>agpl</licence>
<author mail="andrey18106x@gmail.com" homepage="https://github.com/andrey18106">Andrey Borysenko</author>
<author mail="bigcat88@icloud.com" homepage="https://github.com/bigcat88">Alexander Piskun</author>
Expand All @@ -44,7 +44,7 @@ Quick start guide and further information in our [Wiki](https://github.com/cloud
<screenshot>https://raw.githubusercontent.com/cloud-py-api/mediadc/main/screenshots/mediadc_filesplugin.png</screenshot>
<dependencies>
<php min-version="7.4" min-int-size="64" />
<nextcloud min-version="25" max-version="28" />
<nextcloud min-version="28" max-version="29" />
</dependencies>
<background-jobs>
<job>OCA\MediaDC\BackgroundJob\CollectorCleanupJob</job>
Expand Down
3 changes: 2 additions & 1 deletion lib/Command/CollectorTaskNotificationCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ protected function configure(): void {
protected function execute(InputInterface $input, OutputInterface $output): int {
$taskId = $input->getArgument(self::ARGUMENT_TASK_ID);
$status = $input->getArgument(self::ARGUMENT_TASK_STATUS);
/** @var CollectorTask */
/** @var CollectorTask $collectorTask */
$collectorTask = $this->tasksMapper->find(intval($taskId));
$detailGroups = array_map(function ($d) {
$d['files'] = explode(',', $d['files']);
Expand Down Expand Up @@ -103,6 +103,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
'status' => $status,
'duplicate-groups' => count($detailGroups),
'duplicates' => $duplicates,
'name' => $collectorTask->getName(),
]);
$this->notificationManager->notify($notification);
return 0;
Expand Down
8 changes: 8 additions & 0 deletions lib/Migration/data/AppInitialData.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ class AppInitialData {
"displayName" => "Use pre-compiled Python binaries",
"description" => "Use Python part in binary format (located in the appdata folder)"
],
[
"name" => "ignore_orientation",
"value" => false,
"displayName" => "Ignore EXIF image orientation",
"description" => "Enable to allow detection of mirrored images as duplicates"
],
]
];

Expand All @@ -92,5 +98,7 @@ private function _stringsForL10N(): void {
$this->l10n->t("Global administrator's exclude list that applies to each task");
$this->l10n->t("Use pre-compiled Python binaries");
$this->l10n->t("Use Python part in binary format (located in the appdata folder)");
$this->l10n->t("Ignore EXIF image orientation");
$this->l10n->t("Enable to allow detection of mirrored images as duplicates");
}
}
11 changes: 9 additions & 2 deletions lib/Notification/Notifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,16 @@ public function prepare(INotification $notification, string $languageCode): INot

$parameters = $notification->getSubjectParameters();
if ($parameters['status'] === 'finished') {
$notification->setRichSubject($l->t('Task successfully finished, found ' . $parameters['duplicate-groups'] . ' duplicate group(s) (' . $parameters['duplicates'] . ' file(s))'));
if (isset($parameters['name']) && $parameters['name'] !== '') {
$message = $l->t('Task "%s" successfully finished.', [$parameters['name']]);
} else {
$message = $l->t('Task successfully finished.');
}
$filesMessage = $l->n('%n file', '%n files', $parameters['duplicates']);
$message .= ' ' . $l->n('Found %n duplicate group', 'Found %n duplicate groups', $parameters['duplicate-groups']) . ' (' . $filesMessage . ')';
$notification->setRichSubject($message);
} else {
$notification->setRichSubject($l->t('Task finished with status "' . $parameters['status'] . '".'));
$notification->setRichSubject($l->t('Task finished with status {status}', ['status' => $parameters['status']]));
}
$notification->setRichMessage($l->t('Task finished, check out results'));
$notification->setParsedSubject($l->t('Task finished, check out results'));
Expand Down
17 changes: 16 additions & 1 deletion lib/Service/CollectorService.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
use OCP\Files\IRootFolder;
use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Db\MultipleObjectsReturnedException;
use OCP\IL10N;
use Psr\Log\LoggerInterface;
use OCP\BackgroundJob\IJobList;
use OCP\Files\NotFoundException;
Expand Down Expand Up @@ -99,6 +100,7 @@ class CollectorService {
public const TASK_TYPE_MANUAL = 'manual';
public const TASK_TYPE_AUTO = 'auto';
public const TASK_TYPE_QUEUED = 'queued';
private IL10N $l10n;


public function __construct(
Expand All @@ -113,7 +115,8 @@ public function __construct(
VideosService $videosService,
IJobList $jobList,
IPreview $previewManager,
CPAUtilsService $cpaUtils
CPAUtilsService $cpaUtils,
IL10N $l10n,
) {
if ($userId !== null) {
$this->userId = $userId;
Expand All @@ -129,6 +132,7 @@ public function __construct(
$this->videosService = $videosService;
$this->jobList = $jobList;
$this->previewManager = $previewManager;
$this->l10n = $l10n;
}

/**
Expand Down Expand Up @@ -228,6 +232,10 @@ public function restartTask(array $params = []) {
$this->terminate($taskId);

if ($taskData['files_total'] > 0) {
if (!isset($collectorSettings['exif_transpose'])) {
$ignoreOrientationSetting = $this->settingsMapper->findByName('ignore_orientation');
$collectorSettings['exif_transpose'] = !json_decode($ignoreOrientationSetting->getValue());
}
$collectorTask->setTargetDirectoryIds(json_encode($targetDirectoryIds));
$collectorTask->setExcludeList(json_encode($excludeList));
$collectorTask->setCollectorSettings(json_encode($collectorSettings));
Expand Down Expand Up @@ -342,8 +350,10 @@ public function duplicate($taskId): ?CollectorTask {
'hash_size' => $collectorSettings['hash_size'],
'target_mtype' => $collectorSettings['target_mtype'],
'finish_notification' => $collectorSettings['finish_notification'],
'exif_transpose' => $collectorSettings['exif_transpose'] ?? true,
],
'excludeList' => json_decode($collectorTask->getExcludeList(), true),
'name' => '[' . $this->l10n->t('duplicated') . '] ' . $collectorTask->getName(),
]);
return $duplicatedCollectorTask;
}
Expand All @@ -362,6 +372,8 @@ public function createCollectorTask(array $params = [], bool $queued = false): ?
$pyThresholdSetting = $this->settingsMapper->findByName('similarity_threshold');
/** @var Setting */
$pyHashSizeSetting = $this->settingsMapper->findByName('hash_size');
/** @var Setting */
$ignoreOrientationSetting = $this->settingsMapper->findByName('ignore_orientation');
} else {
/** @var string */
$pyAlgorithmSetting = $params['collectorSettings']['hashing_algorithm'];
Expand All @@ -370,6 +382,8 @@ public function createCollectorTask(array $params = [], bool $queued = false): ?
/** @var string */
$pyHashSizeSetting = $params['collectorSettings']['hash_size'];
/** @var Setting */
$ignoreOrientationSetting = $this->settingsMapper->findByName('ignore_orientation');
/** @var Setting */
$excludeListSetting = $this->settingsMapper->findByName('exclude_list');
$excludeList = count($params) === 0 ? [
'admin' => $excludeListSetting->getValue(),
Expand Down Expand Up @@ -404,6 +418,7 @@ public function createCollectorTask(array $params = [], bool $queued = false): ?
'finish_notification' => count($params) === 0
? true : $params['collectorSettings']['finish_notification'],
'duplicated' => isset($params['type']) && $params['type'] === 'duplicated',
'exif_transpose' => count($params) === 0 ? $ignoreOrientationSetting->getValue() : $params['collectorSettings']['exif_transpose'],
]),
'filesScanned' => 0,
'filesTotal' => count($params) === 0
Expand Down

0 comments on commit a41c950

Please sign in to comment.