- You are now connected to RealDebrid! To setup Radarr or Sonarr, please following the instructions here:
+ You are now connected to Real-Debrid! To setup Radarr or Sonarr, please following the instructions here:
https://github.com/rogerfar/rdt-client/.
diff --git a/client/src/app/torrent-download/torrent-download.component.html b/client/src/app/torrent-download/torrent-download.component.html
deleted file mode 100644
index c4fbf06..0000000
--- a/client/src/app/torrent-download/torrent-download.component.html
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
- {{ download.link }}
- {{ download.path }}
- |
-
- {{ download.bytesTotal | filesize }}
- |
-
- {{ download | downloadStatus }}
- |
-
|
diff --git a/client/src/app/torrent-download/torrent-download.component.scss b/client/src/app/torrent-download/torrent-download.component.scss
deleted file mode 100644
index 03bcfa7..0000000
--- a/client/src/app/torrent-download/torrent-download.component.scss
+++ /dev/null
@@ -1,3 +0,0 @@
-td {
- font-size: smaller;
-}
diff --git a/client/src/app/torrent-download/torrent-download.component.ts b/client/src/app/torrent-download/torrent-download.component.ts
deleted file mode 100644
index 85787b6..0000000
--- a/client/src/app/torrent-download/torrent-download.component.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-import { Component, Input, OnInit } from '@angular/core';
-import { Download } from '../models/download.model';
-
-@Component({
- selector: '[app-torrent-download]',
- templateUrl: './torrent-download.component.html',
- styleUrls: ['./torrent-download.component.scss'],
-})
-export class TorrentDownloadComponent implements OnInit {
- @Input()
- public download: Download;
-
- constructor() {}
-
- ngOnInit(): void {}
-}
diff --git a/client/src/app/torrent-file/torrent-file.component.html b/client/src/app/torrent-file/torrent-file.component.html
deleted file mode 100644
index 267193d..0000000
--- a/client/src/app/torrent-file/torrent-file.component.html
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
- {{ file.path }}
- |
-
{{ file.bytes | filesize }} |
-
|
diff --git a/client/src/app/torrent-file/torrent-file.component.scss b/client/src/app/torrent-file/torrent-file.component.scss
deleted file mode 100644
index 03bcfa7..0000000
--- a/client/src/app/torrent-file/torrent-file.component.scss
+++ /dev/null
@@ -1,3 +0,0 @@
-td {
- font-size: smaller;
-}
diff --git a/client/src/app/torrent-file/torrent-file.component.ts b/client/src/app/torrent-file/torrent-file.component.ts
deleted file mode 100644
index 4ae3346..0000000
--- a/client/src/app/torrent-file/torrent-file.component.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-import { Component, Input, OnInit } from '@angular/core';
-import { TorrentFile } from '../models/torrent.model';
-
-@Component({
- selector: '[app-torrent-file]',
- templateUrl: './torrent-file.component.html',
- styleUrls: ['./torrent-file.component.scss'],
-})
-export class TorrentFileComponent implements OnInit {
- @Input()
- public file: TorrentFile;
-
- constructor() {}
-
- ngOnInit(): void {}
-}
diff --git a/client/src/app/torrent-row/torrent-row.component.html b/client/src/app/torrent-row/torrent-row.component.html
deleted file mode 100644
index b69355e..0000000
--- a/client/src/app/torrent-row/torrent-row.component.html
+++ /dev/null
@@ -1,27 +0,0 @@
-
{{ torrent.rdName }} |
-
- {{ torrent.files.length | number }}
- |
-
- {{ torrent.downloads.length | number }}
- |
-
-
- |
-
- {{ torrent.rdSize | filesize }}
- |
-
- {{ torrent | status }}
- |
-
-
-
-
-
-
-
-
-
-
- |
diff --git a/client/src/app/torrent-row/torrent-row.component.scss b/client/src/app/torrent-row/torrent-row.component.scss
deleted file mode 100644
index 6a01b12..0000000
--- a/client/src/app/torrent-row/torrent-row.component.scss
+++ /dev/null
@@ -1,8 +0,0 @@
-.delete-icon {
- color: red;
- cursor: pointer;
-}
-
-.auto .fas {
- margin-right: 4px;
-}
\ No newline at end of file
diff --git a/client/src/app/torrent-row/torrent-row.component.ts b/client/src/app/torrent-row/torrent-row.component.ts
deleted file mode 100644
index 76554c5..0000000
--- a/client/src/app/torrent-row/torrent-row.component.ts
+++ /dev/null
@@ -1,34 +0,0 @@
-import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
-import { Torrent } from 'src/app/models/torrent.model';
-
-@Component({
- selector: '[app-torrent-row]',
- templateUrl: './torrent-row.component.html',
- styleUrls: ['./torrent-row.component.scss'],
-})
-export class TorrentRowComponent implements OnInit {
- @Input()
- public torrent: Torrent;
-
- @Output('delete')
- public delete = new EventEmitter();
-
- @Output('retry')
- public retry = new EventEmitter();
-
- public loading = false;
-
- constructor() {}
-
- ngOnInit(): void {}
-
- public deleteClick(event: Event): void {
- event.stopPropagation();
- this.delete.emit(this.torrent.torrentId);
- }
-
- public retryClick(event: Event): void {
- event.stopPropagation();
- this.retry.emit(this.torrent.torrentId);
- }
-}
diff --git a/client/src/app/torrent-status.pipe.ts b/client/src/app/torrent-status.pipe.ts
index 5d81a0a..2b9b7d6 100644
--- a/client/src/app/torrent-status.pipe.ts
+++ b/client/src/app/torrent-status.pipe.ts
@@ -28,6 +28,11 @@ export class TorrentStatusPipe implements PipeTransform {
const bytesDone = downloading.sum((m) => m.bytesDone);
const bytesTotal = downloading.sum((m) => m.bytesTotal);
let progress = (bytesDone / bytesTotal) * 100;
+
+ if (isNaN(progress)) {
+ progress = 0;
+ }
+
let allSpeeds = downloading.sum((m) => m.speed) / downloading.length;
let speed: string | string[] = '0';
@@ -44,6 +49,11 @@ export class TorrentStatusPipe implements PipeTransform {
const bytesDone = unpacking.sum((m) => m.bytesDone);
const bytesTotal = unpacking.sum((m) => m.bytesTotal);
let progress = (bytesDone / bytesTotal) * 100;
+
+ if (isNaN(progress)) {
+ progress = 0;
+ }
+
let allSpeeds = unpacking.sum((m) => m.speed) / unpacking.length;
if (allSpeeds > 0) {
diff --git a/client/src/app/torrent-table/torrent-table.component.html b/client/src/app/torrent-table/torrent-table.component.html
index ce51221..4f37dc2 100644
--- a/client/src/app/torrent-table/torrent-table.component.html
+++ b/client/src/app/torrent-table/torrent-table.component.html
@@ -7,126 +7,34 @@
| Name |
+ Category |
Files |
Downloads |
- Auto |
Size |
Status |
- Action |
-
-
-
-
- | Downloads |
-
-
-
- | Files in torrent |
-
-
-
-
+
+ |
+ {{ torrent.rdName }}
+ |
+
+ {{ torrent.category }}
+ |
+
+ {{ torrent.files.length | number }}
+ |
+
+ {{ torrent.downloads.length | number }}
+ |
+
+ {{ torrent.rdSize | filesize }}
+ |
+
+ {{ torrent | status }}
+ |
+
diff --git a/client/src/app/torrent-table/torrent-table.component.scss b/client/src/app/torrent-table/torrent-table.component.scss
index fd54999..41c6f23 100644
--- a/client/src/app/torrent-table/torrent-table.component.scss
+++ b/client/src/app/torrent-table/torrent-table.component.scss
@@ -2,11 +2,4 @@ table {
tr {
cursor: pointer;
}
-
- tr.separator {
- td {
- font-size: smaller;
- font-weight: bold;
- }
- }
}
diff --git a/client/src/app/torrent-table/torrent-table.component.ts b/client/src/app/torrent-table/torrent-table.component.ts
index e59569b..6a5a8c9 100644
--- a/client/src/app/torrent-table/torrent-table.component.ts
+++ b/client/src/app/torrent-table/torrent-table.component.ts
@@ -1,4 +1,5 @@
import { Component, OnDestroy, OnInit } from '@angular/core';
+import { Router } from '@angular/router';
import { Torrent } from '../models/torrent.model';
import { TorrentService } from '../torrent.service';
@@ -10,23 +11,8 @@ import { TorrentService } from '../torrent.service';
export class TorrentTableComponent implements OnInit, OnDestroy {
public torrents: Torrent[] = [];
public error: string;
- public showFiles: { [key: string]: boolean } = {};
- public isDeleteModalActive: boolean;
- public deleteError: string;
- public deleting: boolean;
- public deleteTorrentId: string;
- public deleteData: boolean;
- public deleteRdTorrent: boolean;
- public deleteLocalFiles: boolean;
-
- public isRetryModalActive: boolean;
- public retryError: string;
- public retrying: boolean;
- public retryTorrentId: string;
- public retry: number;
-
- constructor(private torrentService: TorrentService) {}
+ constructor(private router: Router, private torrentService: TorrentService) {}
ngOnInit(): void {
this.torrentService.getList().subscribe(
@@ -49,67 +35,11 @@ export class TorrentTableComponent implements OnInit, OnDestroy {
this.torrentService.disconnect();
}
- public selectTorrent(torrent: Torrent): void {
- this.showFiles[torrent.torrentId] = !this.showFiles[torrent.torrentId];
+ public selectTorrent(torrentId: string): void {
+ this.router.navigate([`/torrent/${torrentId}`]);
}
public trackByMethod(index: number, el: Torrent): string {
return el.torrentId;
}
-
- public showDeleteModal(torrentId: string): void {
- this.deleteData = false;
- this.deleteRdTorrent = false;
- this.deleteLocalFiles = false;
-
- this.deleteTorrentId = torrentId;
- this.isDeleteModalActive = true;
- }
-
- public deleteCancel(): void {
- this.isDeleteModalActive = false;
- }
-
- public deleteOk(): void {
- this.deleting = true;
-
- this.torrentService
- .delete(this.deleteTorrentId, this.deleteData, this.deleteRdTorrent, this.deleteLocalFiles)
- .subscribe(
- () => {
- this.isDeleteModalActive = false;
- this.deleting = false;
- },
- (err) => {
- this.deleteError = err.error;
- this.deleting = false;
- }
- );
- }
-
- public showRetryModal(torrentId: string): void {
- this.retry = 0;
-
- this.retryTorrentId = torrentId;
- this.isRetryModalActive = true;
- }
-
- public retryCancel(): void {
- this.isRetryModalActive = false;
- }
-
- public retryOk(): void {
- this.retrying = true;
-
- this.torrentService.retry(this.retryTorrentId, this.retry).subscribe(
- () => {
- this.isRetryModalActive = false;
- this.retrying = false;
- },
- (err) => {
- this.retryError = err.error;
- this.retrying = false;
- }
- );
- }
}
diff --git a/client/src/app/torrent.service.ts b/client/src/app/torrent.service.ts
index 18edb14..4b8f22b 100644
--- a/client/src/app/torrent.service.ts
+++ b/client/src/app/torrent.service.ts
@@ -15,6 +15,10 @@ export class TorrentService {
private connection: signalR.HubConnection;
public connect(): void {
+ if (this.connection != null) {
+ return;
+ }
+
this.connection = new signalR.HubConnectionBuilder().withUrl('/hub').withAutomaticReconnect().build();
this.connection.start().catch((err) => console.error(err));
@@ -31,6 +35,10 @@ export class TorrentService {
return this.http.get