Add option for multiple ignored root directories (#390)

This commit is contained in:
Flaminel
2025-12-20 17:04:36 +02:00
committed by GitHub
parent 4ceff127a7
commit 58a72cef0f
26 changed files with 1244 additions and 56 deletions

View File

@@ -333,17 +333,20 @@
</div>
</div>
<!-- Ignored Root Directory -->
<!-- Ignored Root Directories -->
<div class="field-row">
<label class="field-label">
<i class="pi pi-question-circle field-info-icon"
(click)="openFieldDocs('unlinkedIgnoredRootDir')"
<i class="pi pi-question-circle field-info-icon"
(click)="openFieldDocs('unlinkedIgnoredRootDirs')"
title="Click for documentation"></i>
Ignored Root Directory
Ignored Root Directories
</label>
<div class="field-input">
<input type="text" pInputText formControlName="unlinkedIgnoredRootDir" placeholder="/path/to/directory" />
<small class="form-helper-text">Root directory to ignore when checking for unlinked downloads (used for cross-seed)</small>
<app-mobile-autocomplete
formControlName="unlinkedIgnoredRootDirs"
placeholder="Add directory path"
></app-mobile-autocomplete>
<small class="form-helper-text">Root directories to ignore when checking for unlinked downloads (used for cross-seed)</small>
</div>
</div>

View File

@@ -150,7 +150,7 @@ export class DownloadCleanerSettingsComponent implements OnDestroy, CanComponent
unlinkedEnabled: [{ value: false, disabled: true }],
unlinkedTargetCategory: [{ value: 'cleanuparr-unlinked', disabled: true }, [Validators.required]],
unlinkedUseTag: [{ value: false, disabled: true }],
unlinkedIgnoredRootDir: [{ value: '', disabled: true }],
unlinkedIgnoredRootDirs: [{ value: [], disabled: true }],
unlinkedCategories: [{ value: [], disabled: true }]
}, { validators: [this.validateUnlinkedCategories, this.validateAtLeastOneFeature] });
@@ -341,7 +341,7 @@ export class DownloadCleanerSettingsComponent implements OnDestroy, CanComponent
unlinkedEnabled: config.unlinkedEnabled,
unlinkedTargetCategory: config.unlinkedTargetCategory,
unlinkedUseTag: config.unlinkedUseTag,
unlinkedIgnoredRootDir: config.unlinkedIgnoredRootDir,
unlinkedIgnoredRootDirs: config.unlinkedIgnoredRootDirs || [],
unlinkedCategories: config.unlinkedCategories || []
});
@@ -624,7 +624,7 @@ export class DownloadCleanerSettingsComponent implements OnDestroy, CanComponent
unlinkedEnabled: formValues.unlinkedEnabled,
unlinkedTargetCategory: formValues.unlinkedTargetCategory,
unlinkedUseTag: formValues.unlinkedUseTag,
unlinkedIgnoredRootDir: formValues.unlinkedIgnoredRootDir,
unlinkedIgnoredRootDirs: formValues.unlinkedIgnoredRootDirs || [],
unlinkedCategories: formValues.unlinkedCategories || []
};
@@ -682,7 +682,7 @@ export class DownloadCleanerSettingsComponent implements OnDestroy, CanComponent
unlinkedEnabled: false,
unlinkedTargetCategory: 'cleanuparr-unlinked',
unlinkedUseTag: false,
unlinkedIgnoredRootDir: '',
unlinkedIgnoredRootDirs: [],
unlinkedCategories: []
});
@@ -793,7 +793,7 @@ export class DownloadCleanerSettingsComponent implements OnDestroy, CanComponent
private updateUnlinkedControlsState(enabled: boolean): void {
const targetCategoryControl = this.downloadCleanerForm.get('unlinkedTargetCategory');
const useTagControl = this.downloadCleanerForm.get('unlinkedUseTag');
const ignoredRootDirControl = this.downloadCleanerForm.get('unlinkedIgnoredRootDir');
const ignoredRootDirsControl = this.downloadCleanerForm.get('unlinkedIgnoredRootDirs');
const categoriesControl = this.downloadCleanerForm.get('unlinkedCategories');
// Disable emitting events during bulk changes
@@ -803,13 +803,13 @@ export class DownloadCleanerSettingsComponent implements OnDestroy, CanComponent
// Enable all unlinked controls
targetCategoryControl?.enable(options);
useTagControl?.enable(options);
ignoredRootDirControl?.enable(options);
ignoredRootDirsControl?.enable(options);
categoriesControl?.enable(options);
} else {
// Disable all unlinked controls
targetCategoryControl?.disable(options);
useTagControl?.disable(options);
ignoredRootDirControl?.disable(options);
ignoredRootDirsControl?.disable(options);
categoriesControl?.disable(options);
}
}

View File

@@ -13,7 +13,7 @@ export interface DownloadCleanerConfig {
unlinkedEnabled: boolean;
unlinkedTargetCategory: string;
unlinkedUseTag: boolean;
unlinkedIgnoredRootDir: string;
unlinkedIgnoredRootDirs: string[];
unlinkedCategories: string[];
}
@@ -56,6 +56,6 @@ export const defaultDownloadCleanerConfig: DownloadCleanerConfig = {
unlinkedEnabled: false,
unlinkedTargetCategory: 'cleanuparr-unlinked',
unlinkedUseTag: false,
unlinkedIgnoredRootDir: '',
unlinkedIgnoredRootDirs: [],
unlinkedCategories: []
};