mirror of
https://github.com/Radarr/Radarr.git
synced 2024-09-11 12:02:35 +02:00
Fixed: Processing very long ETA from Transmission
(cherry picked from commit 9800bd6b439257e73e3545e125cd03900a3036bb)
This commit is contained in:
parent
7b2fd5140b
commit
aabf6b9ff8
@ -1,3 +1,4 @@
|
|||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
@ -275,7 +276,7 @@ public void should_only_check_version_number(string version)
|
|||||||
|
|
||||||
[TestCase(-1)] // Infinite/Unknown
|
[TestCase(-1)] // Infinite/Unknown
|
||||||
[TestCase(-2)] // Magnet Downloading
|
[TestCase(-2)] // Magnet Downloading
|
||||||
public void should_ignore_negative_eta(int eta)
|
public void should_ignore_negative_eta(long eta)
|
||||||
{
|
{
|
||||||
_completed.Eta = eta;
|
_completed.Eta = eta;
|
||||||
|
|
||||||
@ -284,6 +285,26 @@ public void should_ignore_negative_eta(int eta)
|
|||||||
item.RemainingTime.Should().NotHaveValue();
|
item.RemainingTime.Should().NotHaveValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TestCase(2147483648)] // 2038-01-19T03:14:08Z > int.MaxValue as unix timestamp can be either an int or a long
|
||||||
|
public void should_support_long_values_for_eta_in_seconds(long eta)
|
||||||
|
{
|
||||||
|
_downloading.Eta = eta;
|
||||||
|
|
||||||
|
PrepareClientToReturnDownloadingItem();
|
||||||
|
var item = Subject.GetItems().Single();
|
||||||
|
item.RemainingTime.Should().Be(TimeSpan.FromSeconds(eta));
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestCase(2147483648000)] // works with milliseconds format too
|
||||||
|
public void should_support_long_values_for_eta_in_milliseconds(long eta)
|
||||||
|
{
|
||||||
|
_downloading.Eta = eta;
|
||||||
|
|
||||||
|
PrepareClientToReturnDownloadingItem();
|
||||||
|
var item = Subject.GetItems().Single();
|
||||||
|
item.RemainingTime.Should().Be(TimeSpan.FromMilliseconds(eta));
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void should_not_be_removable_and_should_not_allow_move_files_if_max_ratio_reached_and_not_stopped()
|
public void should_not_be_removable_and_should_not_allow_move_files_if_max_ratio_reached_and_not_stopped()
|
||||||
{
|
{
|
||||||
|
@ -271,7 +271,7 @@ public void should_fix_forward_slashes()
|
|||||||
|
|
||||||
[TestCase(-1)] // Infinite/Unknown
|
[TestCase(-1)] // Infinite/Unknown
|
||||||
[TestCase(-2)] // Magnet Downloading
|
[TestCase(-2)] // Magnet Downloading
|
||||||
public void should_ignore_negative_eta(int eta)
|
public void should_ignore_negative_eta(long eta)
|
||||||
{
|
{
|
||||||
_completed.Eta = eta;
|
_completed.Eta = eta;
|
||||||
|
|
||||||
|
@ -82,7 +82,14 @@ public override IEnumerable<DownloadClientItem> GetItems()
|
|||||||
|
|
||||||
if (torrent.Eta >= 0)
|
if (torrent.Eta >= 0)
|
||||||
{
|
{
|
||||||
item.RemainingTime = TimeSpan.FromSeconds(torrent.Eta);
|
try
|
||||||
|
{
|
||||||
|
item.RemainingTime = TimeSpan.FromSeconds(torrent.Eta);
|
||||||
|
}
|
||||||
|
catch (OverflowException)
|
||||||
|
{
|
||||||
|
item.RemainingTime = TimeSpan.FromMilliseconds(torrent.Eta);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!torrent.ErrorString.IsNullOrWhiteSpace())
|
if (!torrent.ErrorString.IsNullOrWhiteSpace())
|
||||||
|
@ -9,7 +9,7 @@ public class TransmissionTorrent
|
|||||||
public long TotalSize { get; set; }
|
public long TotalSize { get; set; }
|
||||||
public long LeftUntilDone { get; set; }
|
public long LeftUntilDone { get; set; }
|
||||||
public bool IsFinished { get; set; }
|
public bool IsFinished { get; set; }
|
||||||
public int Eta { get; set; }
|
public long Eta { get; set; }
|
||||||
public TransmissionTorrentStatus Status { get; set; }
|
public TransmissionTorrentStatus Status { get; set; }
|
||||||
public int SecondsDownloading { get; set; }
|
public int SecondsDownloading { get; set; }
|
||||||
public int SecondsSeeding { get; set; }
|
public int SecondsSeeding { get; set; }
|
||||||
|
Loading…
Reference in New Issue
Block a user