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