mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-10-30 07:22:35 +01:00
Found and fixed a bug in EpisodeProvider.GetEpisodesByParseResults, where it would incorrectly return all episodes for a season when a file was detected as a Full Season release.
This commit is contained in:
parent
c296b6975c
commit
117cebe655
@ -234,69 +234,5 @@ namespace NzbDrone.Core.Test
|
||||
db.Fetch<Episode>().Should().HaveCount(2);
|
||||
ep.First().Ignored.Should().BeFalse();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Full_Season_return_all_episodes_for_season()
|
||||
{
|
||||
var mocker = new AutoMoqer();
|
||||
var db = MockLib.GetEmptyDatabase();
|
||||
mocker.SetConstant(db);
|
||||
|
||||
var fakeSeries = Builder<Series>.CreateNew().Build();
|
||||
|
||||
var fakeEpisodes = Builder<Episode>.CreateListOfSize(10)
|
||||
.WhereAll()
|
||||
.Have(e => e.SeriesId = fakeSeries.SeriesId)
|
||||
.Have(e => e.SeasonNumber = 2)
|
||||
.Build();
|
||||
|
||||
db.Insert(fakeSeries);
|
||||
db.InsertMany(fakeEpisodes);
|
||||
|
||||
var parseResult = new EpisodeParseResult
|
||||
{
|
||||
Series = fakeSeries,
|
||||
SeasonNumber = 2,
|
||||
EpisodeNumbers = new List<int>(),
|
||||
FullSeason = true
|
||||
};
|
||||
|
||||
var ep = mocker.Resolve<EpisodeProvider>().GetEpisodesByParseResult(parseResult);
|
||||
|
||||
ep.Should().HaveCount(10);
|
||||
db.Fetch<Episode>().Should().HaveCount(10);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void No_Episodes_Not_a_proper_full_season_release()
|
||||
{
|
||||
var mocker = new AutoMoqer();
|
||||
var db = MockLib.GetEmptyDatabase();
|
||||
mocker.SetConstant(db);
|
||||
|
||||
var fakeSeries = Builder<Series>.CreateNew().Build();
|
||||
|
||||
var fakeEpisodes = Builder<Episode>.CreateListOfSize(10)
|
||||
.WhereAll()
|
||||
.Have(e => e.SeriesId = fakeSeries.SeriesId)
|
||||
.Have(e => e.SeasonNumber = 2)
|
||||
.Build();
|
||||
|
||||
db.Insert(fakeSeries);
|
||||
db.InsertMany(fakeEpisodes);
|
||||
|
||||
var parseResult = new EpisodeParseResult
|
||||
{
|
||||
Series = fakeSeries,
|
||||
SeasonNumber = 2,
|
||||
EpisodeNumbers = new List<int>(),
|
||||
FullSeason = false
|
||||
};
|
||||
|
||||
var ep = mocker.Resolve<EpisodeProvider>().GetEpisodesByParseResult(parseResult);
|
||||
|
||||
ep.Should().HaveCount(0);
|
||||
db.Fetch<Episode>().Should().HaveCount(10);
|
||||
}
|
||||
}
|
||||
}
|
@ -125,14 +125,6 @@ namespace NzbDrone.Core.Providers
|
||||
{
|
||||
var result = new List<Episode>();
|
||||
|
||||
if (parseResult.EpisodeNumbers.Count == 0 && parseResult.FullSeason)
|
||||
{
|
||||
result.AddRange(GetEpisodesBySeason(parseResult.Series.SeriesId, parseResult.SeasonNumber));
|
||||
|
||||
//Return now as no further processing is required
|
||||
return result;
|
||||
}
|
||||
|
||||
foreach (var episodeNumber in parseResult.EpisodeNumbers)
|
||||
{
|
||||
var episodeInfo = GetEpisode(parseResult.Series.SeriesId, parseResult.SeasonNumber, episodeNumber);
|
||||
|
@ -180,7 +180,15 @@ namespace NzbDrone.Core.Providers
|
||||
var parseResult = Parser.ParseTitle(directoryInfo.Name.Substring(8));
|
||||
parseResult.Series = _seriesProvider.FindSeries(parseResult.CleanTitle);
|
||||
|
||||
var episodeIds = _episodeProvider.GetEpisodesByParseResult(parseResult).Select(e => e.EpisodeId);
|
||||
var episodeIds = new List<int>();
|
||||
|
||||
if (parseResult.EpisodeNumbers.Count == 0 && parseResult.FullSeason)
|
||||
episodeIds =
|
||||
_episodeProvider.GetEpisodesBySeason(parseResult.Series.SeriesId, parseResult.SeasonNumber)
|
||||
.Select(e => e.EpisodeId).ToList();
|
||||
|
||||
else
|
||||
episodeIds = _episodeProvider.GetEpisodesByParseResult(parseResult).Select(e => e.EpisodeId).ToList();
|
||||
|
||||
_episodeProvider.SetPostDownloadStatus(episodeIds, postDownloadStatus);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="MiniProfiler" version="1.9" />
|
||||
<package id="Ninject" version="2.2.1.4" />
|
||||
<package id="SqlServerCompact" version="4.0.8482.1" />
|
||||
<package id="MiniProfiler" version="1.9" />
|
||||
</packages>
|
Loading…
Reference in New Issue
Block a user