1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-09-11 12:02:35 +02:00

Fixed: Qbittorrent state and eta fixes (#2789)

Fixes #2785
This commit is contained in:
Qstick 2018-05-21 04:43:06 -04:00 committed by Leonardo Galli
parent f246fa87dd
commit c736df8116
4 changed files with 18 additions and 5 deletions

View File

@ -94,6 +94,7 @@
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Numerics" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="Microsoft.CSharp" />

View File

@ -86,7 +86,7 @@ protected override string AddFromTorrentFile(RemoteMovie remoteMovie, string has
_logger.Warn(ex, "Failed to set the torrent priority for {0}.", filename);
}
SetInitialState(hash);
SetInitialState(hash.ToLower());
return hash;
}
@ -120,7 +120,7 @@ public override IEnumerable<DownloadClientItem> GetItems()
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 @@ private void SetInitialState(string hash)
_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);
}
}
}

View File

@ -1,4 +1,5 @@
using Newtonsoft.Json;
using System.Numerics;
using Newtonsoft.Json;
namespace NzbDrone.Core.Download.Clients.QBittorrent
{
@ -13,7 +14,7 @@ public class QBittorrentTorrent
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

View File

@ -98,6 +98,7 @@
<Reference Include="System.Core" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Numerics" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Web" />
@ -1301,4 +1302,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>