+
+
+
+ Select only the files that are matching this regular expression. Only use this setting OR the Exclude files
+ setting, not both.
+
+
This setting does not apply to manually selected files.
+
{{ includeRegexError }}
+
+
+
+
+ Ignore files that are matching this regular expression. Only use this setting OR the Include files setting, not
+ both.
+
+
This setting does not apply to manually selected files.
+
{{ excludeRegexError }}
+
@@ -210,7 +245,7 @@
diff --git a/client/src/app/add-new-torrent/add-new-torrent.component.scss b/client/src/app/add-new-torrent/add-new-torrent.component.scss
index f6e7423..4d5a055 100644
--- a/client/src/app/add-new-torrent/add-new-torrent.component.scss
+++ b/client/src/app/add-new-torrent/add-new-torrent.component.scss
@@ -30,15 +30,19 @@
.separator::before,
.separator::after {
- content: '';
+ content: "";
flex: 1;
border-bottom: 1px solid darkgray;
}
.separator:not(:empty)::before {
- margin-right: .25em;
+ margin-right: 0.25em;
}
.separator:not(:empty)::after {
- margin-left: .25em;
-}
\ No newline at end of file
+ margin-left: 0.25em;
+}
+
+.strike-through {
+ text-decoration: line-through;
+}
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 3aaad21..856f7da 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
@@ -22,6 +22,8 @@ export class AddNewTorrentComponent implements OnInit {
public downloadAction: number = 0;
public finishedAction: number = 0;
public downloadMinSize: number = 0;
+ public includeRegex: string = '';
+ public excludeRegex: string = '';
public torrentRetryAttempts: number = 1;
public downloadRetryAttempts: number = 3;
public torrentDeleteOnError: number = 0;
@@ -35,12 +37,16 @@ export class AddNewTorrentComponent implements OnInit {
public saving = false;
public error: string;
+ public includeRegexError: string;
+ public excludeRegexError: string;
+ public regexSelected: TorrentFileAvailability[];
+
private selectedFile: File;
constructor(
private router: Router,
private torrentService: TorrentService,
- private settingsService: SettingsService
+ private settingsService: SettingsService,
) {}
ngOnInit(): void {
@@ -56,6 +62,8 @@ export class AddNewTorrentComponent implements OnInit {
settings.first((m) => m.key === 'Gui:Default:OnlyDownloadAvailableFiles')?.value === true ? 1 : 0;
this.finishedAction = settings.first((m) => m.key === 'Gui:Default:FinishedAction')?.value as number;
this.downloadMinSize = settings.first((m) => m.key === 'Gui:Default:MinFileSize')?.value as number;
+ this.includeRegex = settings.first((m) => m.key === 'Gui:Default:IncludeRegex')?.value as string;
+ this.excludeRegex = settings.first((m) => m.key === 'Gui:Default:ExcludeRegex')?.value as string;
this.torrentRetryAttempts = settings.first((m) => m.key === 'Gui:Default:TorrentRetryAttempts')?.value as number;
this.downloadRetryAttempts = settings.first((m) => m.key === 'Gui:Default:DownloadRetryAttempts')
?.value as number;
@@ -68,10 +76,10 @@ export class AddNewTorrentComponent implements OnInit {
}
public setFinishAction() {
- if (this.downloadClient === 2){
- if (this.finishedAction === 1){
+ if (this.downloadClient === 2) {
+ if (this.finishedAction === 1) {
this.finishedAction = 3;
- } else if (this.finishedAction === 2){
+ } else if (this.finishedAction === 2) {
this.finishedAction = 0;
}
}
@@ -140,6 +148,8 @@ export class AddNewTorrentComponent implements OnInit {
torrent.downloadAction = this.downloadAction;
torrent.finishedAction = this.finishedAction;
torrent.downloadMinSize = this.downloadMinSize;
+ torrent.includeRegex = this.includeRegex;
+ torrent.excludeRegex = this.excludeRegex;
torrent.downloadManualFiles = downloadManualFiles;
torrent.priority = this.priority;
torrent.torrentRetryAttempts = this.torrentRetryAttempts;
@@ -156,7 +166,7 @@ export class AddNewTorrentComponent implements OnInit {
(err) => {
this.error = err.error;
this.saving = false;
- }
+ },
);
} else if (this.selectedFile) {
this.torrentService.uploadFile(this.selectedFile, torrent).subscribe(
@@ -166,7 +176,7 @@ export class AddNewTorrentComponent implements OnInit {
(err) => {
this.error = err.error;
this.saving = false;
- }
+ },
);
} else {
this.error = 'No magnet or file uploaded';
@@ -204,7 +214,7 @@ export class AddNewTorrentComponent implements OnInit {
(err) => {
this.error = err.error;
this.saving = false;
- }
+ },
);
} else if (this.selectedFile) {
this.torrentService.checkFiles(this.selectedFile).subscribe(
@@ -218,10 +228,34 @@ export class AddNewTorrentComponent implements OnInit {
(err) => {
this.error = err.error;
this.saving = false;
- }
+ },
);
} else {
this.saving = false;
}
}
+
+ public isRegexExcluded(file: TorrentFileAvailability): boolean {
+ if (this.regexSelected == null) {
+ return false;
+ }
+
+ if (this.regexSelected.find((m) => m.filename === file.filename) == null) {
+ return true;
+ }
+
+ return false;
+ }
+
+ public verifyRegex(): void {
+ this.includeRegexError = null;
+ this.excludeRegexError = null;
+ this.regexSelected = null;
+
+ this.torrentService.verifyRegex(this.includeRegex, this.excludeRegex, this.magnetLink).subscribe((result) => {
+ this.includeRegexError = result.includeError;
+ this.excludeRegexError = result.excludeError;
+ this.regexSelected = result.selectedFiles;
+ });
+ }
}
diff --git a/client/src/app/models/torrent.model.ts b/client/src/app/models/torrent.model.ts
index 681343d..36abb26 100644
--- a/client/src/app/models/torrent.model.ts
+++ b/client/src/app/models/torrent.model.ts
@@ -9,6 +9,8 @@ export class Torrent {
public downloadAction: number;
public finishedAction: number;
public downloadMinSize: number;
+ public includeRegex: string;
+ public excludeRegex: string;
public downloadManualFiles: string;
public added: Date;
diff --git a/client/src/app/torrent.service.ts b/client/src/app/torrent.service.ts
index b228596..cc690d6 100644
--- a/client/src/app/torrent.service.ts
+++ b/client/src/app/torrent.service.ts
@@ -13,7 +13,10 @@ export class TorrentService {
private connection: signalR.HubConnection;
- constructor(private http: HttpClient, @Inject(APP_BASE_HREF) private baseHref: string) {
+ constructor(
+ private http: HttpClient,
+ @Inject(APP_BASE_HREF) private baseHref: string,
+ ) {
this.connect();
}
@@ -71,7 +74,7 @@ export class TorrentService {
torrentId: string,
deleteData: boolean,
deleteRdTorrent: boolean,
- deleteLocalFiles: boolean
+ deleteLocalFiles: boolean,
): Observable
{
return this.http.post(`${this.baseHref}Api/Torrents/Delete/${torrentId}`, {
deleteData,
@@ -91,4 +94,19 @@ export class TorrentService {
public update(torrent: Torrent): Observable {
return this.http.put(`${this.baseHref}Api/Torrents/Update`, torrent);
}
+
+ public verifyRegex(
+ includeRegex: string,
+ excludeRegex: string,
+ magnetLink: string,
+ ): Observable<{ includeError: string; excludeError: string; selectedFiles: TorrentFileAvailability[] }> {
+ return this.http.post<{ includeError: string; excludeError: string; selectedFiles: TorrentFileAvailability[] }>(
+ `${this.baseHref}Api/Torrents/VerifyRegex`,
+ {
+ includeRegex,
+ excludeRegex,
+ magnetLink,
+ },
+ );
+ }
}
diff --git a/client/src/app/torrent/torrent.component.html b/client/src/app/torrent/torrent.component.html
index 83a51de..5abe362 100644
--- a/client/src/app/torrent/torrent.component.html
+++ b/client/src/app/torrent/torrent.component.html
@@ -89,6 +89,14 @@
{{ torrent.downloadMinSize }}MB