parent
98b1a7681b
commit
068eb33bf6
|
@ -99,9 +99,19 @@ namespace Sonarr.Api.V3.Series
|
||||||
|
|
||||||
private List<SeriesResource> AllSeries()
|
private List<SeriesResource> AllSeries()
|
||||||
{
|
{
|
||||||
|
var tvdbId = Request.GetIntegerQueryParameter("tvdbId");
|
||||||
var includeSeasonImages = Request.GetBooleanQueryParameter("includeSeasonImages");
|
var includeSeasonImages = Request.GetBooleanQueryParameter("includeSeasonImages");
|
||||||
var seriesStats = _seriesStatisticsService.SeriesStatistics();
|
var seriesStats = _seriesStatisticsService.SeriesStatistics();
|
||||||
var seriesResources = _seriesService.GetAllSeries().Select(s => s.ToResource(includeSeasonImages)).ToList();
|
var seriesResources = new List<SeriesResource>();
|
||||||
|
|
||||||
|
if (tvdbId > 0)
|
||||||
|
{
|
||||||
|
seriesResources.AddIfNotNull(_seriesService.FindByTvdbId(tvdbId).ToResource(includeSeasonImages));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
seriesResources.AddRange(_seriesService.GetAllSeries().Select(s => s.ToResource(includeSeasonImages)));
|
||||||
|
}
|
||||||
|
|
||||||
MapCoversToLocal(seriesResources.ToArray());
|
MapCoversToLocal(seriesResources.ToArray());
|
||||||
LinkSeriesStatistics(seriesResources, seriesStats);
|
LinkSeriesStatistics(seriesResources, seriesStats);
|
||||||
|
|
|
@ -54,5 +54,17 @@ namespace Sonarr.Http.Extensions
|
||||||
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int GetIntegerQueryParameter(this Request request, string parameter, int defaultValue = 0)
|
||||||
|
{
|
||||||
|
var parameterValue = request.Query[parameter];
|
||||||
|
|
||||||
|
if (parameterValue.HasValue)
|
||||||
|
{
|
||||||
|
return int.Parse(parameterValue.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue