|
|
|
@ -2,6 +2,7 @@ using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using FluentValidation;
|
|
|
|
|
using NzbDrone.Api.Extensions;
|
|
|
|
|
using NzbDrone.Common.Extensions;
|
|
|
|
|
using NzbDrone.Core.Datastore.Events;
|
|
|
|
|
using NzbDrone.Core.MediaCover;
|
|
|
|
@ -86,26 +87,17 @@ namespace NzbDrone.Api.Series
|
|
|
|
|
|
|
|
|
|
private SeriesResource GetSeries(int id)
|
|
|
|
|
{
|
|
|
|
|
var series = _seriesService.GetSeries(id);
|
|
|
|
|
return MapToResource(series);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private SeriesResource MapToResource(Core.Tv.Series series)
|
|
|
|
|
{
|
|
|
|
|
if (series == null) return null;
|
|
|
|
|
var includeSeasonImages = Request.GetBooleanQueryParameter("includeSeasonImages");
|
|
|
|
|
|
|
|
|
|
var resource = series.ToResource();
|
|
|
|
|
MapCoversToLocal(resource);
|
|
|
|
|
FetchAndLinkSeriesStatistics(resource);
|
|
|
|
|
PopulateAlternateTitles(resource);
|
|
|
|
|
|
|
|
|
|
return resource;
|
|
|
|
|
var series = _seriesService.GetSeries(id);
|
|
|
|
|
return MapToResource(series, includeSeasonImages);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private List<SeriesResource> AllSeries()
|
|
|
|
|
{
|
|
|
|
|
var includeSeasonImages = Request.GetBooleanQueryParameter("includeSeasonImages");
|
|
|
|
|
var seriesStats = _seriesStatisticsService.SeriesStatistics();
|
|
|
|
|
var seriesResources = _seriesService.GetAllSeries().ToResource();
|
|
|
|
|
var seriesResources = _seriesService.GetAllSeries().Select(s => s.ToResource(includeSeasonImages)).ToList();
|
|
|
|
|
|
|
|
|
|
MapCoversToLocal(seriesResources.ToArray());
|
|
|
|
|
LinkSeriesStatistics(seriesResources, seriesStats);
|
|
|
|
@ -143,6 +135,18 @@ namespace NzbDrone.Api.Series
|
|
|
|
|
_seriesService.DeleteSeries(id, deleteFiles);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private SeriesResource MapToResource(Core.Tv.Series series, bool includeSeasonImages)
|
|
|
|
|
{
|
|
|
|
|
if (series == null) return null;
|
|
|
|
|
|
|
|
|
|
var resource = series.ToResource(includeSeasonImages);
|
|
|
|
|
MapCoversToLocal(resource);
|
|
|
|
|
FetchAndLinkSeriesStatistics(resource);
|
|
|
|
|
PopulateAlternateTitles(resource);
|
|
|
|
|
|
|
|
|
|
return resource;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void MapCoversToLocal(params SeriesResource[] series)
|
|
|
|
|
{
|
|
|
|
|
foreach (var seriesResource in series)
|
|
|
|
|