mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-10-30 23:42:33 +01:00
New: Prefer anime batch releases over single episode releases
This commit is contained in:
parent
20a2cfe260
commit
ced7a7dce2
@ -217,6 +217,37 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
qualifiedReports.First().RemoteEpisode.ParsedEpisodeInfo.FullSeason.Should().BeTrue();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_prefer_multiepisode_over_single_episode_for_anime()
|
||||
{
|
||||
var remoteEpisode1 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1), GivenEpisode(2) }, new QualityModel(Quality.HDTV720p));
|
||||
var remoteEpisode2 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.HDTV720p));
|
||||
|
||||
remoteEpisode1.Series.SeriesType = SeriesTypes.Anime;
|
||||
remoteEpisode2.Series.SeriesType = SeriesTypes.Anime;
|
||||
|
||||
var decisions = new List<DownloadDecision>();
|
||||
decisions.Add(new DownloadDecision(remoteEpisode1));
|
||||
decisions.Add(new DownloadDecision(remoteEpisode2));
|
||||
|
||||
var qualifiedReports = Subject.PrioritizeDecisions(decisions);
|
||||
qualifiedReports.First().RemoteEpisode.Episodes.Count.Should().Be(remoteEpisode1.Episodes.Count);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_prefer_single_episode_over_multi_episode_for_non_anime()
|
||||
{
|
||||
var remoteEpisode1 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1), GivenEpisode(2) }, new QualityModel(Quality.HDTV720p));
|
||||
var remoteEpisode2 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.HDTV720p));
|
||||
|
||||
var decisions = new List<DownloadDecision>();
|
||||
decisions.Add(new DownloadDecision(remoteEpisode1));
|
||||
decisions.Add(new DownloadDecision(remoteEpisode2));
|
||||
|
||||
var qualifiedReports = Subject.PrioritizeDecisions(decisions);
|
||||
qualifiedReports.First().RemoteEpisode.Episodes.Count.Should().Be(remoteEpisode2.Episodes.Count);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_prefer_releases_with_more_seeders()
|
||||
{
|
||||
|
@ -4,6 +4,7 @@ using System.Linq;
|
||||
using NzbDrone.Core.Indexers;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Profiles.Delay;
|
||||
using NzbDrone.Core.Tv;
|
||||
|
||||
namespace NzbDrone.Core.DecisionEngine
|
||||
{
|
||||
@ -75,8 +76,21 @@ namespace NzbDrone.Core.DecisionEngine
|
||||
|
||||
private int CompareEpisodeCount(DownloadDecision x, DownloadDecision y)
|
||||
{
|
||||
return CompareAll(CompareBy(x.RemoteEpisode, y.RemoteEpisode, remoteEpisode => remoteEpisode.ParsedEpisodeInfo.FullSeason),
|
||||
CompareByReverse(x.RemoteEpisode, y.RemoteEpisode, remoteEpisode => remoteEpisode.Episodes.Count));
|
||||
var seasonPackCompare = CompareBy(x.RemoteEpisode, y.RemoteEpisode,
|
||||
remoteEpisode => remoteEpisode.ParsedEpisodeInfo.FullSeason);
|
||||
|
||||
if (seasonPackCompare != 0)
|
||||
{
|
||||
return seasonPackCompare;
|
||||
}
|
||||
|
||||
if (x.RemoteEpisode.Series.SeriesType == SeriesTypes.Anime &
|
||||
y.RemoteEpisode.Series.SeriesType == SeriesTypes.Anime)
|
||||
{
|
||||
return CompareBy(x.RemoteEpisode, y.RemoteEpisode, remoteEpisode => remoteEpisode.Episodes.Count);
|
||||
}
|
||||
|
||||
return CompareByReverse(x.RemoteEpisode, y.RemoteEpisode, remoteEpisode => remoteEpisode.Episodes.Count);
|
||||
}
|
||||
|
||||
private int CompareEpisodeNumber(DownloadDecision x, DownloadDecision y)
|
||||
|
Loading…
Reference in New Issue
Block a user