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; } public Int64 Priority { get; set; }
[JsonProperty("progress")] [JsonProperty("progress")]
public Decimal Progress { get; set; } public Single Progress { get; set; }
[JsonProperty("ratio")] [JsonProperty("ratio")]
public Int64 Ratio { get; set; } public Int64 Ratio { get; set; }

View file

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