Fixed: Delays use minutes not hours

pull/4/head
Mark McDowall 10 years ago
parent b4c6284fae
commit a5dd0cce29

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

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

@ -85,14 +85,14 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.RssSync
var oldest = _pendingReleaseService.OldestPendingRelease(subject.Series.Id, episodeIds); 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(); 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"); return Decision.Reject("Waiting for better quality release");
} }

@ -40,6 +40,18 @@ namespace NzbDrone.Core.Parser.Model
private set { } 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() public override string ToString()
{ {
return String.Format("[{0}] {1} [{2}]", PublishDate, Title, Size); return String.Format("[{0}] {1} [{2}]", PublishDate, Title, Size);

Loading…
Cancel
Save