mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-19 04:59:35 -07:00
New: Alternative titles on Series Details UI
This commit is contained in:
parent
fd531eda36
commit
612ca49281
8 changed files with 93 additions and 24 deletions
|
@ -13,6 +13,7 @@ using NzbDrone.Api.Validation;
|
|||
using NzbDrone.Api.Mapping;
|
||||
using NzbDrone.Core.Tv.Events;
|
||||
using NzbDrone.Core.Validation.Paths;
|
||||
using NzbDrone.Core.DataAugmentation.Scene;
|
||||
|
||||
namespace NzbDrone.Api.Series
|
||||
{
|
||||
|
@ -27,11 +28,13 @@ namespace NzbDrone.Api.Series
|
|||
private readonly ICommandExecutor _commandExecutor;
|
||||
private readonly ISeriesService _seriesService;
|
||||
private readonly ISeriesStatisticsService _seriesStatisticsService;
|
||||
private readonly ISceneMappingService _sceneMappingService;
|
||||
private readonly IMapCoversToLocal _coverMapper;
|
||||
|
||||
public SeriesModule(ICommandExecutor commandExecutor,
|
||||
ISeriesService seriesService,
|
||||
ISeriesStatisticsService seriesStatisticsService,
|
||||
ISceneMappingService sceneMappingService,
|
||||
IMapCoversToLocal coverMapper,
|
||||
RootFolderValidator rootFolderValidator,
|
||||
PathExistsValidator pathExistsValidator,
|
||||
|
@ -44,6 +47,8 @@ namespace NzbDrone.Api.Series
|
|||
_commandExecutor = commandExecutor;
|
||||
_seriesService = seriesService;
|
||||
_seriesStatisticsService = seriesStatisticsService;
|
||||
_sceneMappingService = sceneMappingService;
|
||||
|
||||
_coverMapper = coverMapper;
|
||||
|
||||
GetResourceAll = AllSeries;
|
||||
|
@ -67,6 +72,21 @@ namespace NzbDrone.Api.Series
|
|||
PostValidator.RuleFor(s => s.TvdbId).GreaterThan(0).SetValidator(seriesExistsValidator);
|
||||
}
|
||||
|
||||
private void PopulateAlternativeTitles(List<SeriesResource> resources)
|
||||
{
|
||||
foreach (var resource in resources)
|
||||
{
|
||||
PopulateAlternativeTitles(resource);
|
||||
}
|
||||
}
|
||||
|
||||
private void PopulateAlternativeTitles(SeriesResource resource)
|
||||
{
|
||||
var mapping = _sceneMappingService.FindByTvdbid(resource.TvdbId);
|
||||
if (mapping == null) return;
|
||||
resource.AlternativeTitles = mapping.Select(x => x.Title).Distinct().ToList();
|
||||
}
|
||||
|
||||
private SeriesResource GetSeries(int id)
|
||||
{
|
||||
var series = _seriesService.GetSeries(id);
|
||||
|
@ -80,6 +100,7 @@ namespace NzbDrone.Api.Series
|
|||
var resource = series.InjectTo<SeriesResource>();
|
||||
MapCoversToLocal(resource);
|
||||
FetchAndLinkSeriesStatistics(resource);
|
||||
PopulateAlternativeTitles(resource);
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
@ -91,6 +112,7 @@ namespace NzbDrone.Api.Series
|
|||
|
||||
MapCoversToLocal(seriesResources.ToArray());
|
||||
LinkSeriesStatistics(seriesResources, seriesStats);
|
||||
PopulateAlternativeTitles(seriesResources);
|
||||
|
||||
return seriesResources;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue