From e2195944e4e5f5c9bc366c033a3ef294d124014c Mon Sep 17 00:00:00 2001 From: Sylvain DUARTE Date: Sat, 14 Mar 2026 11:46:00 +0100 Subject: [PATCH] Add categories list from settings in add-new-torrent (cherry picked from commit 20b08c52a73f1f2725d96a520c7cdd511906b8ef) --- .../add-new-torrent.component.html | 23 ++++++++++++++++--- .../add-new-torrent.component.ts | 17 ++++++++++++++ 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/client/src/app/add-new-torrent/add-new-torrent.component.html b/client/src/app/add-new-torrent/add-new-torrent.component.html index 56b1c68..8156fc9 100644 --- a/client/src/app/add-new-torrent/add-new-torrent.component.html +++ b/client/src/app/add-new-torrent/add-new-torrent.component.html @@ -220,9 +220,26 @@
-
- -
+ @if (categories.length > 0) { +
+ +
+ @if (categorySelect === '__custom__') { +
+ +
+ } + } @else { +
+ +
+ }

The category becomes a sub-folder in your main download path.

diff --git a/client/src/app/add-new-torrent/add-new-torrent.component.ts b/client/src/app/add-new-torrent/add-new-torrent.component.ts index a96198c..47dd1e0 100644 --- a/client/src/app/add-new-torrent/add-new-torrent.component.ts +++ b/client/src/app/add-new-torrent/add-new-torrent.component.ts @@ -25,6 +25,8 @@ export class AddNewTorrentComponent implements OnInit { public downloadClient: number; public category: string; + public categories: string[] = []; + public categorySelect: string = ''; public hostDownloadAction: number = 0; public downloadAction: number = 0; public finishedAction: number = 0; @@ -81,6 +83,13 @@ export class AddNewTorrentComponent implements OnInit { this.downloadClient = settings.find((m) => m.key === 'DownloadClient:Client')?.value as number; this.category = settings.find((m) => m.key === 'Gui:Default:Category')?.value as string; + const categoriesSetting = settings.find((m) => m.key === 'General:Categories')?.value as string; + this.categories = (categoriesSetting ?? '').split(',').map((c) => c.trim()).filter((c) => c.length > 0); + if (this.categories.includes(this.category)) { + this.categorySelect = this.category; + } else if (this.category) { + this.categorySelect = '__custom__'; + } this.hostDownloadAction = this.downloadAction = settings.find((m) => m.key === 'Gui:Default:HostDownloadAction') ?.value as number; this.downloadAction = @@ -100,6 +109,14 @@ export class AddNewTorrentComponent implements OnInit { }); } + public onCategorySelectChange(value: string): void { + if (value !== '__custom__') { + this.category = value; + } else { + this.category = ''; + } + } + public setFinishAction() { if (this.downloadClient === 2) { if (this.finishedAction === 1) {