diff --git a/server/RdtClient.Service/Models/QBittorrent/TorrentInfo.cs b/server/RdtClient.Service/Models/QBittorrent/TorrentInfo.cs index f852ff4..b56ea3e 100644 --- a/server/RdtClient.Service/Models/QBittorrent/TorrentInfo.cs +++ b/server/RdtClient.Service/Models/QBittorrent/TorrentInfo.cs @@ -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; } diff --git a/server/RdtClient.Service/Services/QBittorrent.cs b/server/RdtClient.Service/Services/QBittorrent.cs index 2fb18d5..e83cc0e 100644 --- a/server/RdtClient.Service/Services/QBittorrent.cs +++ b/server/RdtClient.Service/Services/QBittorrent.cs @@ -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,