diff --git a/src/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj b/src/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj index a607e14ac..a548af729 100644 --- a/src/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj +++ b/src/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj @@ -94,6 +94,7 @@ + diff --git a/src/NzbDrone.Core/Download/Clients/QBittorrent/QBittorrent.cs b/src/NzbDrone.Core/Download/Clients/QBittorrent/QBittorrent.cs index 07e248bef..dd8f70ae3 100644 --- a/src/NzbDrone.Core/Download/Clients/QBittorrent/QBittorrent.cs +++ b/src/NzbDrone.Core/Download/Clients/QBittorrent/QBittorrent.cs @@ -86,7 +86,7 @@ namespace NzbDrone.Core.Download.Clients.QBittorrent _logger.Warn(ex, "Failed to set the torrent priority for {0}.", filename); } - SetInitialState(hash); + SetInitialState(hash.ToLower()); return hash; } @@ -120,7 +120,7 @@ namespace NzbDrone.Core.Download.Clients.QBittorrent item.TotalSize = torrent.Size; item.DownloadClient = Definition.Name; item.RemainingSize = (long)(torrent.Size * (1.0 - torrent.Progress)); - item.RemainingTime = TimeSpan.FromSeconds(torrent.Eta); + item.RemainingTime = GetRemainingTime(torrent); item.OutputPath = _remotePathMappingService.RemapRemoteToLocal(Settings.Host, new OsPath(torrent.SavePath)); @@ -346,5 +346,15 @@ namespace NzbDrone.Core.Download.Clients.QBittorrent _logger.Warn(ex, "Failed to set inital state for {0}.", hash); } } + + protected TimeSpan? GetRemainingTime(QBittorrentTorrent torrent) + { + if (torrent.Eta< 0 || torrent.Eta> 365 * 24 * 3600) + { + return null; + } + + return TimeSpan.FromSeconds((int) torrent.Eta); + } } } diff --git a/src/NzbDrone.Core/Download/Clients/QBittorrent/QBittorrentTorrent.cs b/src/NzbDrone.Core/Download/Clients/QBittorrent/QBittorrentTorrent.cs index 266d22f95..04b803401 100644 --- a/src/NzbDrone.Core/Download/Clients/QBittorrent/QBittorrentTorrent.cs +++ b/src/NzbDrone.Core/Download/Clients/QBittorrent/QBittorrentTorrent.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json; +using System.Numerics; +using Newtonsoft.Json; namespace NzbDrone.Core.Download.Clients.QBittorrent { @@ -13,7 +14,7 @@ namespace NzbDrone.Core.Download.Clients.QBittorrent public double Progress { get; set; } // Torrent progress (%/100) - public ulong Eta { get; set; } // Torrent ETA (seconds) + public BigInteger Eta { get; set; } // Torrent ETA (seconds) public string State { get; set; } // Torrent state. See possible values here below diff --git a/src/NzbDrone.Core/NzbDrone.Core.csproj b/src/NzbDrone.Core/NzbDrone.Core.csproj index fe203847f..688604d79 100644 --- a/src/NzbDrone.Core/NzbDrone.Core.csproj +++ b/src/NzbDrone.Core/NzbDrone.Core.csproj @@ -98,6 +98,7 @@ + @@ -1301,4 +1302,4 @@ --> - + \ No newline at end of file