mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-04 10:02:40 +01:00
removed join from EpisodesBetweenDates, should be join in memoery in the API
This commit is contained in:
parent
0c63e5ad81
commit
88cd6a3213
@ -187,7 +187,6 @@
|
|||||||
<Compile Include="HelperTests\SortHelperTest.cs" />
|
<Compile Include="HelperTests\SortHelperTest.cs" />
|
||||||
<Compile Include="DecisionEngineTests\AcceptableSizeSpecificationFixture.cs" />
|
<Compile Include="DecisionEngineTests\AcceptableSizeSpecificationFixture.cs" />
|
||||||
<Compile Include="Qualities\QualitySizeServiceFixture.cs" />
|
<Compile Include="Qualities\QualitySizeServiceFixture.cs" />
|
||||||
<Compile Include="ProviderTests\MisnamedProviderTest.cs" />
|
|
||||||
<Compile Include="ProviderTests\EventClientProviderTest.cs" />
|
<Compile Include="ProviderTests\EventClientProviderTest.cs" />
|
||||||
<Compile Include="ProviderTests\XbmcProviderTest.cs" />
|
<Compile Include="ProviderTests\XbmcProviderTest.cs" />
|
||||||
<Compile Include="TvTests\EpisodeProviderTests\EpisodeProviderTest_GetEpisodesByParseResult.cs" />
|
<Compile Include="TvTests\EpisodeProviderTests\EpisodeProviderTest_GetEpisodesByParseResult.cs" />
|
||||||
|
@ -1,260 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using FizzWare.NBuilder;
|
|
||||||
using FluentAssertions;
|
|
||||||
using Moq;
|
|
||||||
using NUnit.Framework;
|
|
||||||
using NzbDrone.Core.MediaFiles;
|
|
||||||
using NzbDrone.Core.Organizer;
|
|
||||||
using NzbDrone.Core.Tv;
|
|
||||||
using NzbDrone.Core.Providers;
|
|
||||||
|
|
||||||
using NzbDrone.Core.Test.Framework;
|
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test.ProviderTests
|
|
||||||
{
|
|
||||||
[TestFixture]
|
|
||||||
public class MisnamedProviderTest : CoreTest<MisnamedProvider>
|
|
||||||
{
|
|
||||||
[Test]
|
|
||||||
public void no_misnamed_files()
|
|
||||||
{
|
|
||||||
|
|
||||||
var series = Builder<Series>.CreateNew()
|
|
||||||
.With(s => s.Title = "SeriesTitle")
|
|
||||||
.Build();
|
|
||||||
|
|
||||||
var episodeFiles = Builder<EpisodeFile>.CreateListOfSize(2)
|
|
||||||
.TheFirst(1)
|
|
||||||
.With(f => f.Id = 1)
|
|
||||||
.With(f => f.Path = @"C:\Test\Title1.avi")
|
|
||||||
.TheNext(1)
|
|
||||||
.With(f => f.Id = 2)
|
|
||||||
.With(f => f.Path = @"C:\Test\Title2.avi")
|
|
||||||
.Build().ToList();
|
|
||||||
|
|
||||||
var episodes = Builder<Episode>.CreateListOfSize(2)
|
|
||||||
.All()
|
|
||||||
.With(e => e.Series = series)
|
|
||||||
.TheFirst(1)
|
|
||||||
.With(e => e.EpisodeFile = episodeFiles[0])
|
|
||||||
.TheNext(1)
|
|
||||||
.With(e => e.EpisodeFile = episodeFiles[1])
|
|
||||||
.Build().ToList();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Mocker.GetMock<IEpisodeService>()
|
|
||||||
.Setup(c => c.EpisodesWithFiles()).Returns(episodes);
|
|
||||||
|
|
||||||
Mocker.GetMock<IBuildFileNames>()
|
|
||||||
.Setup(c => c.BuildFilename(new List<Episode> { episodes[0] }, It.IsAny<Series>(), episodeFiles[0]))
|
|
||||||
.Returns("Title1");
|
|
||||||
|
|
||||||
Mocker.GetMock<IBuildFileNames>()
|
|
||||||
.Setup(c => c.BuildFilename(new List<Episode> { episodes[1] }, It.IsAny<Series>(), episodeFiles[1]))
|
|
||||||
.Returns("Title2");
|
|
||||||
|
|
||||||
|
|
||||||
var totalItems = 0;
|
|
||||||
var misnamedEpisodes = Subject.MisnamedFiles(1, 10, out totalItems);
|
|
||||||
|
|
||||||
|
|
||||||
misnamedEpisodes.Should().HaveCount(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void all_misnamed_files()
|
|
||||||
{
|
|
||||||
|
|
||||||
var series = Builder<Series>.CreateNew()
|
|
||||||
.With(s => s.Title = "SeriesTitle")
|
|
||||||
.Build();
|
|
||||||
|
|
||||||
var episodeFiles = Builder<EpisodeFile>.CreateListOfSize(2)
|
|
||||||
.TheFirst(1)
|
|
||||||
.With(f => f.Id = 1)
|
|
||||||
.With(f => f.Path = @"C:\Test\Title1.avi")
|
|
||||||
.TheNext(1)
|
|
||||||
.With(f => f.Id = 2)
|
|
||||||
.With(f => f.Path = @"C:\Test\Title2.avi")
|
|
||||||
.Build();
|
|
||||||
|
|
||||||
var episodes = Builder<Episode>.CreateListOfSize(2)
|
|
||||||
.All()
|
|
||||||
.With(e => e.Series = series)
|
|
||||||
.TheFirst(1)
|
|
||||||
.With(e => e.EpisodeFile = episodeFiles[0])
|
|
||||||
.TheNext(1)
|
|
||||||
.With(e => e.EpisodeFile = episodeFiles[1])
|
|
||||||
.Build().ToList();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Mocker.GetMock<IEpisodeService>()
|
|
||||||
.Setup(c => c.EpisodesWithFiles()).Returns(episodes);
|
|
||||||
|
|
||||||
Mocker.GetMock<IBuildFileNames>()
|
|
||||||
.Setup(c => c.BuildFilename(new List<Episode> { episodes[0] }, It.IsAny<Series>(), episodeFiles[0]))
|
|
||||||
.Returns("New Title 1");
|
|
||||||
|
|
||||||
Mocker.GetMock<IBuildFileNames>()
|
|
||||||
.Setup(c => c.BuildFilename(new List<Episode> { episodes[1] }, It.IsAny<Series>(), episodeFiles[1]))
|
|
||||||
.Returns("New Title 2");
|
|
||||||
|
|
||||||
|
|
||||||
var totalItems = 0;
|
|
||||||
var misnamedEpisodes = Subject.MisnamedFiles(1, 10, out totalItems);
|
|
||||||
|
|
||||||
|
|
||||||
misnamedEpisodes.Should().HaveCount(2);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void one_misnamed_file()
|
|
||||||
{
|
|
||||||
|
|
||||||
var series = Builder<Series>.CreateNew()
|
|
||||||
.With(s => s.Title = "SeriesTitle")
|
|
||||||
.Build();
|
|
||||||
|
|
||||||
var episodeFiles = Builder<EpisodeFile>.CreateListOfSize(2)
|
|
||||||
.TheFirst(1)
|
|
||||||
.With(f => f.Id = 1)
|
|
||||||
.With(f => f.Path = @"C:\Test\Title1.avi")
|
|
||||||
.TheNext(1)
|
|
||||||
.With(f => f.Id = 2)
|
|
||||||
.With(f => f.Path = @"C:\Test\Title2.avi")
|
|
||||||
.Build();
|
|
||||||
|
|
||||||
var episodes = Builder<Episode>.CreateListOfSize(2)
|
|
||||||
.All()
|
|
||||||
.With(e => e.Series = series)
|
|
||||||
.TheFirst(1)
|
|
||||||
.With(e => e.EpisodeFile = episodeFiles[0])
|
|
||||||
.TheNext(1)
|
|
||||||
.With(e => e.EpisodeFile = episodeFiles[1])
|
|
||||||
.Build().ToList();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Mocker.GetMock<IEpisodeService>()
|
|
||||||
.Setup(c => c.EpisodesWithFiles()).Returns(episodes);
|
|
||||||
|
|
||||||
Mocker.GetMock<IBuildFileNames>()
|
|
||||||
.Setup(c => c.BuildFilename(new List<Episode> { episodes[0] }, It.IsAny<Series>(), episodeFiles[0]))
|
|
||||||
.Returns("New Title 1");
|
|
||||||
|
|
||||||
Mocker.GetMock<IBuildFileNames>()
|
|
||||||
.Setup(c => c.BuildFilename(new List<Episode> { episodes[1] }, It.IsAny<Series>(), episodeFiles[1]))
|
|
||||||
.Returns("Title2");
|
|
||||||
|
|
||||||
|
|
||||||
var totalItems = 0;
|
|
||||||
var misnamedEpisodes = Subject.MisnamedFiles(1, 10, out totalItems);
|
|
||||||
|
|
||||||
|
|
||||||
misnamedEpisodes.Should().HaveCount(1);
|
|
||||||
misnamedEpisodes[0].CurrentName.Should().Be("Title1");
|
|
||||||
misnamedEpisodes[0].ProperName.Should().Be("New Title 1");
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
[Ignore]
|
|
||||||
public void misnamed_multi_episode_file()
|
|
||||||
{
|
|
||||||
|
|
||||||
var series = Builder<Series>.CreateNew()
|
|
||||||
.With(s => s.Title = "SeriesTitle")
|
|
||||||
.Build();
|
|
||||||
|
|
||||||
var episodeFiles = Builder<EpisodeFile>.CreateListOfSize(2)
|
|
||||||
.TheFirst(1)
|
|
||||||
.With(f => f.Id = 1)
|
|
||||||
.With(f => f.Path = @"C:\Test\Title1.avi")
|
|
||||||
.TheNext(1)
|
|
||||||
.With(f => f.Id = 2)
|
|
||||||
.With(f => f.Path = @"C:\Test\Title2.avi")
|
|
||||||
.Build().ToList();
|
|
||||||
|
|
||||||
var episodes = Builder<Episode>.CreateListOfSize(3)
|
|
||||||
.All()
|
|
||||||
.With(e => e.Series = series)
|
|
||||||
.TheFirst(2)
|
|
||||||
.With(e => e.EpisodeFile = episodeFiles[0])
|
|
||||||
.TheNext(1)
|
|
||||||
.With(e => e.EpisodeFile = episodeFiles[1])
|
|
||||||
.Build().ToList();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Mocker.GetMock<IEpisodeService>()
|
|
||||||
.Setup(c => c.EpisodesWithFiles()).Returns(episodes);
|
|
||||||
|
|
||||||
Mocker.GetMock<IBuildFileNames>()
|
|
||||||
.Setup(c => c.BuildFilename(new List<Episode> { episodes[0], episodes[1] }, It.IsAny<Series>(), episodeFiles[0]))
|
|
||||||
.Returns("New Title 1");
|
|
||||||
|
|
||||||
Mocker.GetMock<IBuildFileNames>()
|
|
||||||
.Setup(c => c.BuildFilename(new List<Episode> { episodes[2] }, It.IsAny<Series>(), episodeFiles[1]))
|
|
||||||
.Returns("Title2");
|
|
||||||
|
|
||||||
|
|
||||||
var totalItems = 0;
|
|
||||||
var misnamedEpisodes = Subject.MisnamedFiles(1, 10, out totalItems);
|
|
||||||
|
|
||||||
|
|
||||||
misnamedEpisodes.Should().HaveCount(1);
|
|
||||||
misnamedEpisodes[0].CurrentName.Should().Be("Title1");
|
|
||||||
misnamedEpisodes[0].ProperName.Should().Be("New Title 1");
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
[Ignore]
|
|
||||||
public void no_misnamed_multi_episode_file()
|
|
||||||
{
|
|
||||||
|
|
||||||
var series = Builder<Series>.CreateNew()
|
|
||||||
.With(s => s.Title = "SeriesTitle")
|
|
||||||
.Build();
|
|
||||||
|
|
||||||
var episodeFiles = Builder<EpisodeFile>.CreateListOfSize(2)
|
|
||||||
.TheFirst(1)
|
|
||||||
.With(f => f.Id = 1)
|
|
||||||
.With(f => f.Path = @"C:\Test\Title1.avi")
|
|
||||||
.TheNext(1)
|
|
||||||
.With(f => f.Id = 2)
|
|
||||||
.With(f => f.Path = @"C:\Test\Title2.avi")
|
|
||||||
.Build().ToList();
|
|
||||||
|
|
||||||
var episodes = Builder<Episode>.CreateListOfSize(3)
|
|
||||||
.All()
|
|
||||||
.With(e => e.Series = series)
|
|
||||||
.TheFirst(2)
|
|
||||||
.With(e => e.EpisodeFile = episodeFiles[0])
|
|
||||||
.TheNext(1)
|
|
||||||
.With(e => e.EpisodeFile = episodeFiles[1])
|
|
||||||
.Build().ToList();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Mocker.GetMock<IEpisodeService>()
|
|
||||||
.Setup(c => c.EpisodesWithFiles()).Returns(episodes);
|
|
||||||
|
|
||||||
Mocker.GetMock<IBuildFileNames>()
|
|
||||||
.Setup(c => c.BuildFilename(new List<Episode> { episodes[0], episodes[1] }, It.IsAny<Series>(), episodeFiles[0]))
|
|
||||||
.Returns("Title1");
|
|
||||||
|
|
||||||
Mocker.GetMock<IBuildFileNames>()
|
|
||||||
.Setup(c => c.BuildFilename(new List<Episode> { episodes[2] }, It.IsAny<Series>(), episodeFiles[1]))
|
|
||||||
.Returns("Title2");
|
|
||||||
|
|
||||||
|
|
||||||
var totalItems = 0;
|
|
||||||
var misnamedEpisodes = Subject.MisnamedFiles(1, 10, out totalItems);
|
|
||||||
|
|
||||||
|
|
||||||
misnamedEpisodes.Should().HaveCount(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -464,9 +464,6 @@
|
|||||||
<Compile Include="MediaFiles\MediaFileService.cs">
|
<Compile Include="MediaFiles\MediaFileService.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Providers\MisnamedProvider.cs">
|
|
||||||
<SubType>Code</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="Providers\NotificationProvider.cs">
|
<Compile Include="Providers\NotificationProvider.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
@ -1,61 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using NzbDrone.Core.Organizer;
|
|
||||||
using NzbDrone.Core.Tv;
|
|
||||||
using NzbDrone.Core.Model;
|
|
||||||
|
|
||||||
|
|
||||||
namespace NzbDrone.Core.Providers
|
|
||||||
{
|
|
||||||
public class MisnamedProvider
|
|
||||||
{
|
|
||||||
private readonly IEpisodeService _episodeService;
|
|
||||||
private readonly IBuildFileNames _buildFileNames;
|
|
||||||
|
|
||||||
|
|
||||||
public MisnamedProvider(IEpisodeService episodeService, IBuildFileNames buildFileNames)
|
|
||||||
{
|
|
||||||
_episodeService = episodeService;
|
|
||||||
_buildFileNames = buildFileNames;
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual List<MisnamedEpisodeModel> MisnamedFiles(int pageNumber, int pageSize, out int totalItems)
|
|
||||||
{
|
|
||||||
var misnamedFiles = new List<MisnamedEpisodeModel>();
|
|
||||||
|
|
||||||
var episodesWithFiles = _episodeService.EpisodesWithFiles().GroupBy(e => e.EpisodeFileId).ToList();
|
|
||||||
totalItems = episodesWithFiles.Count();
|
|
||||||
|
|
||||||
var misnamedFilesSelect = episodesWithFiles.AsParallel().Where(
|
|
||||||
w =>
|
|
||||||
w.First().EpisodeFile.Value.Path !=
|
|
||||||
_buildFileNames.BuildFilename(w.Select(e => e).ToList(), w.First().Series, w.First().EpisodeFile)).Skip(Math.Max(pageSize * (pageNumber - 1), 0)).Take(pageSize);
|
|
||||||
|
|
||||||
//Process the episodes
|
|
||||||
misnamedFilesSelect.AsParallel().ForAll(f =>
|
|
||||||
{
|
|
||||||
var episodes = f.Select(e => e).ToList();
|
|
||||||
var firstEpisode = episodes[0];
|
|
||||||
var properName = _buildFileNames.BuildFilename(episodes, firstEpisode.Series,
|
|
||||||
firstEpisode.EpisodeFile);
|
|
||||||
|
|
||||||
var currentName = Path.GetFileNameWithoutExtension(firstEpisode.EpisodeFile.Value.Path);
|
|
||||||
|
|
||||||
if (properName != currentName)
|
|
||||||
{
|
|
||||||
misnamedFiles.Add(new MisnamedEpisodeModel
|
|
||||||
{
|
|
||||||
CurrentName = currentName,
|
|
||||||
EpisodeFileId = firstEpisode.EpisodeFileId,
|
|
||||||
ProperName = properName,
|
|
||||||
SeriesTitle = firstEpisode.Series.Value.Title
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return misnamedFiles.OrderBy(e => e.SeriesTitle).ToList();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -23,25 +23,9 @@ public class Episode : ModelBase
|
|||||||
public int SceneSeasonNumber { get; set; }
|
public int SceneSeasonNumber { get; set; }
|
||||||
public int SceneEpisodeNumber { get; set; }
|
public int SceneEpisodeNumber { get; set; }
|
||||||
|
|
||||||
public bool HasFile
|
|
||||||
{
|
|
||||||
get { return EpisodeFileId != 0; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public String SeriesTitle { get; private set; }
|
public String SeriesTitle { get; private set; }
|
||||||
|
|
||||||
public LazyLoaded<Series> Series { get; set; }
|
|
||||||
|
|
||||||
public LazyLoaded<EpisodeFile> EpisodeFile { get; set; }
|
public LazyLoaded<EpisodeFile> EpisodeFile { get; set; }
|
||||||
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
string seriesTitle = Series == null ? "[NULL]" : Series.Value.Title;
|
|
||||||
|
|
||||||
if (Series != null && Series.Value.SeriesType == SeriesTypes.Daily && AirDate.HasValue)
|
|
||||||
return string.Format("{0} - {1:yyyy-MM-dd}", seriesTitle, AirDate.Value);
|
|
||||||
|
|
||||||
return string.Format("{0} - S{1:00}E{2:00}", seriesTitle, SeasonNumber, EpisodeNumber);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -83,13 +83,12 @@ public PagingSpec<Episode> EpisodesWithoutFiles(PagingSpec<Episode> pagingSpec,
|
|||||||
startingSeasonNumber = 0;
|
startingSeasonNumber = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
var pagingQuery = Query.Join<Episode, Series>(JoinType.Inner, e => e.Series, (e, s) => e.SeriesId == s.Id)
|
var pagingQuery = Query.Where(e => e.EpisodeFileId == 0)
|
||||||
.Where(e => e.EpisodeFileId == 0)
|
.AndWhere(e => e.SeasonNumber >= startingSeasonNumber)
|
||||||
.AndWhere(e => e.SeasonNumber >= startingSeasonNumber)
|
.AndWhere(e => e.AirDate <= currentTime)
|
||||||
.AndWhere(e => e.AirDate <= currentTime)
|
.OrderBy(pagingSpec.OrderByClause(), pagingSpec.ToSortDirection())
|
||||||
.OrderBy(pagingSpec.OrderByClause(), pagingSpec.ToSortDirection())
|
.Skip(pagingSpec.PagingOffset())
|
||||||
.Skip(pagingSpec.PagingOffset())
|
.Take(pagingSpec.PageSize);
|
||||||
.Take(pagingSpec.PageSize);
|
|
||||||
|
|
||||||
pagingSpec.Records = pagingQuery.ToList();
|
pagingSpec.Records = pagingQuery.ToList();
|
||||||
|
|
||||||
@ -116,8 +115,7 @@ public List<Episode> EpisodesWithFiles()
|
|||||||
|
|
||||||
public List<Episode> EpisodesBetweenDates(DateTime startDate, DateTime endDate)
|
public List<Episode> EpisodesBetweenDates(DateTime startDate, DateTime endDate)
|
||||||
{
|
{
|
||||||
return Query.Join<Episode, Series>(JoinType.Inner, e => e.Series, (e, s) => e.SeriesId == s.Id)
|
return Query.Where<Episode>(e => e.AirDate >= startDate)
|
||||||
.Where<Episode>(e => e.AirDate >= startDate)
|
|
||||||
.AndWhere(e => e.AirDate <= endDate).ToList();
|
.AndWhere(e => e.AirDate <= endDate).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,7 +180,6 @@ public void RefreshEpisodeInfo(Series series)
|
|||||||
}
|
}
|
||||||
|
|
||||||
episodeToUpdate.SeriesId = series.Id;
|
episodeToUpdate.SeriesId = series.Id;
|
||||||
episodeToUpdate.Series = series;
|
|
||||||
episodeToUpdate.TvDbEpisodeId = episode.TvDbEpisodeId;
|
episodeToUpdate.TvDbEpisodeId = episode.TvDbEpisodeId;
|
||||||
episodeToUpdate.EpisodeNumber = episode.EpisodeNumber;
|
episodeToUpdate.EpisodeNumber = episode.EpisodeNumber;
|
||||||
episodeToUpdate.SeasonNumber = episode.SeasonNumber;
|
episodeToUpdate.SeasonNumber = episode.SeasonNumber;
|
||||||
@ -208,7 +207,7 @@ public void RefreshEpisodeInfo(Series series)
|
|||||||
int episodeCount = 0;
|
int episodeCount = 0;
|
||||||
foreach (var episode in group.OrderBy(e => e.SeasonNumber).ThenBy(e => e.EpisodeNumber))
|
foreach (var episode in group.OrderBy(e => e.SeasonNumber).ThenBy(e => e.EpisodeNumber))
|
||||||
{
|
{
|
||||||
episode.AirDate = episode.AirDate.Value.AddMinutes(episode.Series.Value.Runtime * episodeCount);
|
episode.AirDate = episode.AirDate.Value.AddMinutes(series.Runtime * episodeCount);
|
||||||
episodeCount++;
|
episodeCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -326,17 +325,5 @@ private void DeleteEpisodesNotInTvdb(Series series, IEnumerable<Episode> tvdbEpi
|
|||||||
|
|
||||||
logger.Trace("Deleted episodes that no longer exist in TVDB for {0}", series.Id);
|
logger.Trace("Deleted episodes that no longer exist in TVDB for {0}", series.Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Episode> LinkSeriesToEpisodes(List<Episode> episodes)
|
|
||||||
{
|
|
||||||
var series = _seriesService.GetSeriesInList(episodes.Select(e => e.SeriesId).Distinct());
|
|
||||||
|
|
||||||
episodes.ForEach(e =>
|
|
||||||
{
|
|
||||||
e.Series = series.SingleOrDefault(s => s.Id == e.SeriesId);
|
|
||||||
});
|
|
||||||
|
|
||||||
return episodes;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user