commit
995cee66f3
3 changed files with 23 additions and 15 deletions
|
|
@ -6,7 +6,7 @@ import { RealDebridStatus, Torrent } from './models/torrent.model';
|
||||||
name: 'status',
|
name: 'status',
|
||||||
})
|
})
|
||||||
export class TorrentStatusPipe implements PipeTransform {
|
export class TorrentStatusPipe implements PipeTransform {
|
||||||
constructor(private pipe: FileSizePipe) {}
|
constructor(private pipe: FileSizePipe) { }
|
||||||
|
|
||||||
transform(torrent: Torrent): string {
|
transform(torrent: Torrent): string {
|
||||||
if (torrent.error) {
|
if (torrent.error) {
|
||||||
|
|
@ -38,9 +38,8 @@ export class TorrentStatusPipe implements PipeTransform {
|
||||||
|
|
||||||
speed = this.pipe.transform(allSpeeds, 'filesize');
|
speed = this.pipe.transform(allSpeeds, 'filesize');
|
||||||
|
|
||||||
return `Downloading file ${downloading.length + downloaded.length}/${
|
return `Downloading file ${downloading.length + downloaded.length}/${torrent.downloads.length
|
||||||
torrent.downloads.length
|
} (${progress.toFixed(2)}% - ${speed}/s)`;
|
||||||
} (${progress.toFixed(2)}% - ${speed}/s)`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const unpacking = torrent.downloads.where((m) => m.unpackingStarted && !m.unpackingFinished && m.bytesDone > 0);
|
const unpacking = torrent.downloads.where((m) => m.unpackingStarted && !m.unpackingFinished && m.bytesDone > 0);
|
||||||
|
|
@ -87,6 +86,9 @@ export class TorrentStatusPipe implements PipeTransform {
|
||||||
|
|
||||||
switch (torrent.rdStatus) {
|
switch (torrent.rdStatus) {
|
||||||
case RealDebridStatus.Downloading:
|
case RealDebridStatus.Downloading:
|
||||||
|
if (torrent.rdSeeders < 1) {
|
||||||
|
return `Torrent stalled`
|
||||||
|
}
|
||||||
const speed = this.pipe.transform(torrent.rdSpeed, 'filesize');
|
const speed = this.pipe.transform(torrent.rdSpeed, 'filesize');
|
||||||
return `Torrent downloading (${torrent.rdProgress}% - ${speed}/s)`;
|
return `Torrent downloading (${torrent.rdProgress}% - ${speed}/s)`;
|
||||||
case RealDebridStatus.Processing:
|
case RealDebridStatus.Processing:
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th>Category</th>
|
<th>Category</th>
|
||||||
<th>Priority</th>
|
<th>Priority</th>
|
||||||
|
<th>Seeders</th>
|
||||||
<th>Files</th>
|
<th>Files</th>
|
||||||
<th>Downloads</th>
|
<th>Downloads</th>
|
||||||
<th>Size</th>
|
<th>Size</th>
|
||||||
|
|
@ -40,6 +41,9 @@
|
||||||
<td>
|
<td>
|
||||||
{{ torrent.priority }}
|
{{ torrent.priority }}
|
||||||
</td>
|
</td>
|
||||||
|
<td>
|
||||||
|
{{ torrent.rdSeeders }}
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{{ torrent.files.length | number }}
|
{{ torrent.files.length | number }}
|
||||||
</td>
|
</td>
|
||||||
|
|
|
||||||
|
|
@ -224,8 +224,10 @@ public class QBittorrent
|
||||||
torrentPath = Path.Combine(downloadPath, torrent.RdName) + Path.DirectorySeparatorChar;
|
torrentPath = Path.Combine(downloadPath, torrent.RdName) + Path.DirectorySeparatorChar;
|
||||||
}
|
}
|
||||||
|
|
||||||
var bytesDone = torrent.RdProgress;
|
Decimal? rdProgress = torrent.RdProgress / 100.0m;
|
||||||
|
Decimal? downloadProgress = 0;
|
||||||
var bytesTotal = torrent.RdSize;
|
var bytesTotal = torrent.RdSize;
|
||||||
|
var bytesDone = (long?)(torrent.RdSize * rdProgress);
|
||||||
var speed = torrent.RdSpeed ?? 0;
|
var speed = torrent.RdSpeed ?? 0;
|
||||||
|
|
||||||
if (torrent.Downloads.Count > 0)
|
if (torrent.Downloads.Count > 0)
|
||||||
|
|
@ -233,14 +235,10 @@ public class QBittorrent
|
||||||
bytesDone = torrent.Downloads.Sum(m => m.BytesDone);
|
bytesDone = torrent.Downloads.Sum(m => m.BytesDone);
|
||||||
bytesTotal = torrent.Downloads.Sum(m => m.BytesTotal);
|
bytesTotal = torrent.Downloads.Sum(m => m.BytesTotal);
|
||||||
speed = (Int32) torrent.Downloads.Average(m => m.Speed);
|
speed = (Int32) torrent.Downloads.Average(m => m.Speed);
|
||||||
|
downloadProgress = bytesTotal > 0 ? (Decimal?)bytesDone / bytesTotal : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
var progress = (bytesDone / (Single?)bytesTotal);
|
Decimal? progress = (rdProgress + downloadProgress) / 2m;
|
||||||
|
|
||||||
if (progress == null || !Single.IsNormal(progress.Value))
|
|
||||||
{
|
|
||||||
progress = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
var result = new TorrentInfo
|
var result = new TorrentInfo
|
||||||
{
|
{
|
||||||
|
|
@ -267,10 +265,10 @@ public class QBittorrent
|
||||||
Name = torrent.RdName,
|
Name = torrent.RdName,
|
||||||
NumComplete = 10,
|
NumComplete = 10,
|
||||||
NumIncomplete = 0,
|
NumIncomplete = 0,
|
||||||
NumLeechs = 100,
|
NumLeechs = 1,
|
||||||
NumSeeds = 100,
|
NumSeeds = torrent.RdSeeders ?? 1,
|
||||||
Priority = ++prio,
|
Priority = ++prio,
|
||||||
Progress = (Single) progress,
|
Progress = (float)(progress ?? 0),
|
||||||
Ratio = 1,
|
Ratio = 1,
|
||||||
RatioLimit = 1,
|
RatioLimit = 1,
|
||||||
SavePath = downloadPath,
|
SavePath = downloadPath,
|
||||||
|
|
@ -298,6 +296,10 @@ public class QBittorrent
|
||||||
{
|
{
|
||||||
result.State = "pausedUP";
|
result.State = "pausedUP";
|
||||||
}
|
}
|
||||||
|
else if (torrent.RdStatus == TorrentStatus.Downloading && torrent.RdSeeders < 1)
|
||||||
|
{
|
||||||
|
result.State = "stalledDL";
|
||||||
|
}
|
||||||
|
|
||||||
results.Add(result);
|
results.Add(result);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue