Fixed process status fields in qBittorrent API

This commit is contained in:
Roger Far 2021-01-13 16:30:42 -07:00
parent 4f0d75a9f5
commit fe5a2a5940
2 changed files with 18 additions and 18 deletions

View file

@ -86,7 +86,7 @@ namespace RdtClient.Service.Models.QBittorrent
public Int64 Priority { get; set; }
[JsonProperty("progress")]
public Decimal Progress { get; set; }
public Single Progress { get; set; }
[JsonProperty("ratio")]
public Int64 Ratio { get; set; }

View file

@ -255,16 +255,17 @@ namespace RdtClient.Service.Services
var result = new TorrentInfo
{
AddedOn = torrent.Added.ToUnixTimeSeconds(),
AmountLeft = (Int64) (bytesDone * (100.0 - bytesTotal) / 100.0),
AmountLeft = bytesTotal - bytesDone,
AutoTmm = false,
Availability = 2,
Category = torrent.Category ?? "",
Completed = (Int64) (bytesTotal * (bytesDone / 100.0)),
Completed = bytesDone,
CompletionOn = torrent.Completed?.ToUnixTimeSeconds(),
ContentPath = torrentPath,
DlLimit = -1,
Dlspeed = speed,
Downloaded = (Int64) (bytesTotal * (bytesDone / 100.0)),
DownloadedSession = (Int64) (bytesTotal * (bytesDone / 100.0)),
Downloaded = bytesDone,
DownloadedSession = bytesDone,
Eta = 0,
FlPiecePrio = false,
ForceStart = false,
@ -279,24 +280,23 @@ namespace RdtClient.Service.Services
NumLeechs = 100,
NumSeeds = 100,
Priority = ++prio,
Progress = (Int64) (bytesDone / 100.0),
Progress = bytesTotal * (bytesDone / 100.0f) / 100.0f,
Ratio = 1,
RatioLimit = 1,
ContentPath = torrentPath,
SavePath = downloadPath,
SeedingTimeLimit = 1,
SeenComplete = DateTimeOffset.UtcNow.ToUnixTimeSeconds(),
SeqDl = false,
State = "downloading",
Size = bytesTotal,
State = "downloading",
SuperSeeding = false,
Tags = "",
TimeActive = (Int64) (torrent.Added - DateTimeOffset.UtcNow).TotalMinutes,
TimeActive = (Int64) (DateTimeOffset.UtcNow - torrent.Added).TotalSeconds,
TotalSize = bytesTotal,
Tracker = "udp://tracker.opentrackr.org:1337",
UpLimit = -1,
Uploaded = (Int64) (bytesTotal * (bytesDone / 100.0)),
UploadedSession = (Int64) (bytesTotal * (bytesDone / 100.0)),
Uploaded = bytesDone,
UploadedSession = bytesDone,
Upspeed = speed
};
@ -388,21 +388,21 @@ namespace RdtClient.Service.Services
NbConnectionsLimit = 100,
Peers = 0,
PeersTotal = 2,
PieceSize = torrent.Files.Count > 0 ? bytesTotal / torrent.Files.Count : 0,
PieceSize = bytesTotal,
PiecesHave = torrent.Downloads.Count(m => m.Completed.HasValue),
PiecesNum = torrent.Files.Count,
PiecesNum = torrent.Downloads.Count,
Reannounce = 0,
SavePath = savePath,
SeedingTime = 1,
Seeds = 100,
SeedsTotal = 100,
ShareRatio = 9999,
TimeElapsed = (Int64) (torrent.Added - DateTimeOffset.UtcNow).TotalMinutes,
TotalDownloaded = (Int64) (bytesTotal * (bytesDone / 100.0)),
TotalDownloadedSession = (Int64) (bytesTotal * (bytesDone / 100.0)),
TimeElapsed = (Int64) (DateTimeOffset.UtcNow - torrent.Added).TotalSeconds,
TotalDownloaded = bytesTotal,
TotalDownloadedSession = bytesTotal,
TotalSize = bytesTotal,
TotalUploaded = (Int64) (bytesTotal * (bytesDone / 100.0)),
TotalUploadedSession = (Int64) (bytesTotal * (bytesDone / 100.0)),
TotalUploaded = bytesTotal,
TotalUploadedSession = bytesTotal,
TotalWasted = 0,
UpLimit = -1,
UpSpeed = speed,