Skip to content

Commit

Permalink
added ignoreOrientation option for collectorSettings
Browse files Browse the repository at this point in the history
Signed-off-by: Andrey Borysenko <andrey18106x@gmail.com>
  • Loading branch information
andrey18106 committed Nov 4, 2023
1 parent 6584312 commit 7e787f9
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 11 deletions.
2 changes: 2 additions & 0 deletions lib/Service/CollectorService.php
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ 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(),
Expand Down Expand Up @@ -409,6 +410,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' => $params['collectorSettings']['exif_transpose'],
]),
'filesScanned' => 0,
'filesTotal' => count($params) === 0
Expand Down
20 changes: 15 additions & 5 deletions src/components/tasks/TasksEdit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,14 @@
<input v-model="taskName"
type="text"
:placeholder="t('mediadc', 'Task name')">
<NcCheckboxRadioSwitch :checked.sync="finishNotification">
{{ t('mediadc', 'Finish notification') }}
</NcCheckboxRadioSwitch>
<NcActions>
<NcActionCheckbox v-tooltip="t('mediadc', 'Send notification on task finish')" :checked.sync="finishNotification">
{{ t('mediadc', 'Finish notification') }}
</NcActionCheckbox>
<NcActionCheckbox v-tooltip="t('mediadc', 'Detected images with changed orientation as duplicates')" :checked.sync="ignoreOrientation">
{{ t('mediadc', 'Ignore orientation') }}
</NcActionCheckbox>
</NcActions>
</div>
</div>
</div>
Expand All @@ -204,7 +209,8 @@ import { generateUrl } from '@nextcloud/router'
import { getFilePickerBuilder, showWarning, showSuccess, showError } from '@nextcloud/dialogs'
import { emit } from '@nextcloud/event-bus'
import NcCheckboxRadioSwitch from '@nextcloud/vue/dist/Components/NcCheckboxRadioSwitch.js'
import NcActions from '@nextcloud/vue/dist/Components/NcActions.js'
import NcActionCheckbox from '@nextcloud/vue/dist/Components/NcActionCheckbox.js'
import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
import PlusThick from 'vue-material-design-icons/PlusThick.vue'
Expand All @@ -215,8 +221,9 @@ import { requestFileInfo, getFileId } from '../../utils/files.js'
export default {
name: 'TasksEdit',
components: {
NcActions,
NcActionCheckbox,
NcButton,
NcCheckboxRadioSwitch,
PlusThick,
},
data() {
Expand All @@ -232,6 +239,7 @@ export default {
addingCustomMask: false,
runningTask: false,
finishNotification: true,
ignoreOrientation: true,
taskName: '',
}
},
Expand All @@ -251,6 +259,7 @@ export default {
this.targetMimeType = JSON.parse(this.task.collector_settings).target_mtype
this.similarity_threshold = JSON.parse(this.task.collector_settings).similarity_threshold
this.finishNotification = JSON.parse(this.task.collector_settings).finish_notification
this.ignoreOrientation = !JSON.parse(this.task.collector_settings)?.exif_transpose || false
this.taskName = this.task.name
this.parseTaskSettings()
},
Expand Down Expand Up @@ -360,6 +369,7 @@ export default {
hash_size: Number(this.settingByName('hash_size').value) || 16,
target_mtype: this.targetMimeType,
finish_notification: this.finishNotification,
exif_transpose: !this.ignoreOrientation,
},
name: this.taskName,
}).then(res => {
Expand Down
20 changes: 14 additions & 6 deletions src/components/tasks/TasksNew.vue
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,14 @@
<input v-model="taskName"
type="text"
:placeholder="t('mediadc', 'Task name')">
<NcCheckboxRadioSwitch v-tooltip="t('mediadc', 'Send notification on task finish')"
:checked.sync="finishNotification">
{{ t('mediadc', 'Finish notification') }}
</NcCheckboxRadioSwitch>
<NcActions>
<NcActionCheckbox v-tooltip="t('mediadc', 'Send notification on task finish')" :checked.sync="finishNotification">
{{ t('mediadc', 'Finish notification') }}
</NcActionCheckbox>
<NcActionCheckbox v-tooltip="t('mediadc', 'Detected images with changed orientation as duplicates')" :checked.sync="ignoreOrientation">
{{ t('mediadc', 'Ignore orientation') }}
</NcActionCheckbox>
</NcActions>
</div>
</div>
</template>
Expand All @@ -206,14 +210,16 @@ import { mapActions, mapGetters } from 'vuex'
import { requestFileInfo, getFileId } from '../../utils/files.js'
import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
import NcCheckboxRadioSwitch from '@nextcloud/vue/dist/Components/NcCheckboxRadioSwitch.js'
import NcActions from '@nextcloud/vue/dist/Components/NcActions.js'
import NcActionCheckbox from '@nextcloud/vue/dist/Components/NcActionCheckbox.js'
import PlusThick from 'vue-material-design-icons/PlusThick.vue'
export default {
name: 'TasksNew',
components: {
NcButton,
NcCheckboxRadioSwitch,
NcActions,
NcActionCheckbox,
PlusThick,
},
data() {
Expand All @@ -229,6 +235,7 @@ export default {
addingCustomMask: false,
runningTask: false,
finishNotification: true,
ignoreOrientation: true,
taskName: '',
}
},
Expand Down Expand Up @@ -334,6 +341,7 @@ export default {
hash_size: this.settingByName('hash_size').value || 16,
target_mtype: this.targetMimeType,
finish_notification: this.finishNotification,
exif_transpose: !this.ignoreOrientation,
},
}).then(res => {
this.runningTask = false
Expand Down
1 change: 1 addition & 0 deletions src/filesplugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ function createNewTaskFromFolder(folderId, folderName = null) {
hash_size: settingByName(settings, 'hash_size').value || 16,
target_mtype: 2,
finish_notification: true,
exif_transpose: false,
},
name: folderName,
}
Expand Down

0 comments on commit 7e787f9

Please sign in to comment.