Fixed: Delays use minutes not hours

This commit is contained in:
Mark McDowall 2014-12-09 20:48:25 -08:00
parent b4c6284fae
commit a5dd0cce29
4 changed files with 21 additions and 8 deletions

View File

@ -14,6 +14,7 @@ namespace NzbDrone.Api.Indexers
public Int32 QualityWeight { get; set; }
public Int32 Age { get; set; }
public Double AgeHours { get; set; }
public Double AgeMinutes { get; set; }
public Int64 Size { get; set; }
public String Indexer { get; set; }
public String ReleaseGroup { get; set; }

View File

@ -114,7 +114,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests.RssSync
_remoteEpisode.ParsedEpisodeInfo.Quality = new QualityModel(Quality.HDTV720p);
_remoteEpisode.Release.PublishDate = DateTime.UtcNow.AddHours(-10);
_delayProfile.UsenetDelay = 1;
_delayProfile.UsenetDelay = 60;
Subject.IsSatisfiedBy(_remoteEpisode, null).Accepted.Should().BeTrue();
}
@ -125,7 +125,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests.RssSync
_remoteEpisode.ParsedEpisodeInfo.Quality = new QualityModel(Quality.SDTV);
_remoteEpisode.Release.PublishDate = DateTime.UtcNow;
_delayProfile.UsenetDelay = 12;
_delayProfile.UsenetDelay = 720;
Subject.IsSatisfiedBy(_remoteEpisode, null).Accepted.Should().BeFalse();
}
@ -143,7 +143,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests.RssSync
.Setup(s => s.IsRevisionUpgrade(It.IsAny<QualityModel>(), It.IsAny<QualityModel>()))
.Returns(true);
_delayProfile.UsenetDelay = 12;
_delayProfile.UsenetDelay = 720;
Subject.IsSatisfiedBy(_remoteEpisode, null).Accepted.Should().BeTrue();
}
@ -161,7 +161,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests.RssSync
.Setup(s => s.IsRevisionUpgrade(It.IsAny<QualityModel>(), It.IsAny<QualityModel>()))
.Returns(true);
_delayProfile.UsenetDelay = 12;
_delayProfile.UsenetDelay = 720;
Subject.IsSatisfiedBy(_remoteEpisode, null).Accepted.Should().BeTrue();
}
@ -174,7 +174,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests.RssSync
GivenExistingFile(new QualityModel(Quality.SDTV));
_delayProfile.UsenetDelay = 12;
_delayProfile.UsenetDelay = 720;
Subject.IsSatisfiedBy(_remoteEpisode, null).Accepted.Should().BeFalse();
}

View File

@ -85,14 +85,14 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.RssSync
var oldest = _pendingReleaseService.OldestPendingRelease(subject.Series.Id, episodeIds);
if (oldest != null && oldest.Release.AgeHours > delay)
if (oldest != null && oldest.Release.AgeMinutes > delay)
{
return Decision.Accept();
}
if (subject.Release.AgeHours < delay)
if (subject.Release.AgeMinutes < delay)
{
_logger.Debug("Waiting for better quality release, There is a {0} hour delay on {1}", delay, subject.Release.DownloadProtocol);
_logger.Debug("Waiting for better quality release, There is a {0} minute delay on {1}", delay, subject.Release.DownloadProtocol);
return Decision.Reject("Waiting for better quality release");
}

View File

@ -40,6 +40,18 @@ namespace NzbDrone.Core.Parser.Model
private set { }
}
public Double AgeMinutes
{
get
{
return DateTime.UtcNow.Subtract(PublishDate).TotalMinutes;
}
//This prevents manually downloading a release from blowing up in mono
//TODO: Is there a better way?
private set { }
}
public override string ToString()
{
return String.Format("[{0}] {1} [{2}]", PublishDate, Title, Size);