mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-10 04:52:42 +01:00
GetEpisodesByParseResult will return multiple episode names when multiple episodes are found.
This commit is contained in:
parent
dba5a1a236
commit
f3fbcec8cb
@ -127,7 +127,6 @@ public void Multi_GetSeason_Episode_Exists()
|
||||
ep.Should().HaveCount(2);
|
||||
Db.Fetch<Episode>().Should().HaveCount(2);
|
||||
ep.First().ShouldHave().AllPropertiesBut(e => e.Series);
|
||||
parseResult.EpisodeTitle.Should().Be(fakeEpisode.Title);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -313,5 +312,77 @@ public void GetEpisodeParseResult_get_daily_should_not_add_new_episode_when_auto
|
||||
episodes.Should().BeEmpty();
|
||||
Db.Fetch<Episode>().Should().BeEmpty();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetEpisodeParseResult_should_return_multiple_titles_for_multiple_episodes()
|
||||
{
|
||||
WithRealDb();
|
||||
|
||||
var fakeEpisode = Builder<Episode>.CreateNew()
|
||||
.With(e => e.SeriesId = 1)
|
||||
.With(e => e.SeasonNumber = 2)
|
||||
.With(e => e.EpisodeNumber = 10)
|
||||
.With(e => e.Title = "Title1")
|
||||
.Build();
|
||||
|
||||
var fakeEpisode2 = Builder<Episode>.CreateNew()
|
||||
.With(e => e.SeriesId = 1)
|
||||
.With(e => e.SeasonNumber = 2)
|
||||
.With(e => e.EpisodeNumber = 11)
|
||||
.With(e => e.Title = "Title2")
|
||||
.Build();
|
||||
|
||||
var fakeSeries = Builder<Series>.CreateNew().Build();
|
||||
|
||||
Db.Insert(fakeEpisode);
|
||||
Db.Insert(fakeEpisode2);
|
||||
Db.Insert(fakeSeries);
|
||||
|
||||
var parseResult = new EpisodeParseResult
|
||||
{
|
||||
Series = fakeSeries,
|
||||
SeasonNumber = 2,
|
||||
EpisodeNumbers = new List<int> { 10, 11 }
|
||||
};
|
||||
|
||||
var ep = Mocker.Resolve<EpisodeProvider>().GetEpisodesByParseResult(parseResult);
|
||||
|
||||
ep.Should().HaveCount(2);
|
||||
Db.Fetch<Episode>().Should().HaveCount(2);
|
||||
ep.First().ShouldHave().AllPropertiesBut(e => e.Series);
|
||||
parseResult.EpisodeTitle.Should().Be(fakeEpisode.Title + " + " + fakeEpisode2.Title);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetEpisodeParseResult_should_return_single_title_for_single_episode()
|
||||
{
|
||||
WithRealDb();
|
||||
|
||||
var fakeEpisode = Builder<Episode>.CreateNew()
|
||||
.With(e => e.SeriesId = 1)
|
||||
.With(e => e.SeasonNumber = 2)
|
||||
.With(e => e.EpisodeNumber = 10)
|
||||
.With(e => e.Title = "Title1")
|
||||
.Build();
|
||||
|
||||
var fakeSeries = Builder<Series>.CreateNew().Build();
|
||||
|
||||
Db.Insert(fakeEpisode);
|
||||
Db.Insert(fakeSeries);
|
||||
|
||||
var parseResult = new EpisodeParseResult
|
||||
{
|
||||
Series = fakeSeries,
|
||||
SeasonNumber = 2,
|
||||
EpisodeNumbers = new List<int> { 10 }
|
||||
};
|
||||
|
||||
var ep = Mocker.Resolve<EpisodeProvider>().GetEpisodesByParseResult(parseResult);
|
||||
|
||||
ep.Should().HaveCount(1);
|
||||
Db.Fetch<Episode>().Should().HaveCount(1);
|
||||
ep.First().ShouldHave().AllPropertiesBut(e => e.Series);
|
||||
parseResult.EpisodeTitle.Should().Be(fakeEpisode.Title);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -161,6 +161,7 @@ public virtual IList<Episode> GetEpisodesByParseResult(EpisodeParseResult parseR
|
||||
if (episodeInfo != null)
|
||||
{
|
||||
result.Add(episodeInfo);
|
||||
parseResult.EpisodeTitle = episodeInfo.Title;
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -199,7 +200,8 @@ public virtual IList<Episode> GetEpisodesByParseResult(EpisodeParseResult parseR
|
||||
if (episodeInfo != null)
|
||||
{
|
||||
result.Add(episodeInfo);
|
||||
parseResult.EpisodeTitle = episodeInfo.Title;
|
||||
parseResult.EpisodeTitle += String.Format(" + {0}", episodeInfo.Title);
|
||||
parseResult.EpisodeTitle = parseResult.EpisodeTitle.Trim('+', ' ');
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user