mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-14 11:23:42 +02:00
parent
b3959e3162
commit
be02d0ebf7
@ -7,6 +7,7 @@
|
||||
using NzbDrone.Core.DecisionEngine.Specifications;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.History;
|
||||
using NzbDrone.Core.Tv;
|
||||
using Sonarr.Api.V3.Episodes;
|
||||
using Sonarr.Api.V3.Series;
|
||||
using Sonarr.Http;
|
||||
@ -21,16 +22,19 @@ public class HistoryController : Controller
|
||||
private readonly ICustomFormatCalculationService _formatCalculator;
|
||||
private readonly IUpgradableSpecification _upgradableSpecification;
|
||||
private readonly IFailedDownloadService _failedDownloadService;
|
||||
private readonly ISeriesService _seriesService;
|
||||
|
||||
public HistoryController(IHistoryService historyService,
|
||||
ICustomFormatCalculationService formatCalculator,
|
||||
IUpgradableSpecification upgradableSpecification,
|
||||
IFailedDownloadService failedDownloadService)
|
||||
IFailedDownloadService failedDownloadService,
|
||||
ISeriesService seriesService)
|
||||
{
|
||||
_historyService = historyService;
|
||||
_formatCalculator = formatCalculator;
|
||||
_upgradableSpecification = upgradableSpecification;
|
||||
_failedDownloadService = failedDownloadService;
|
||||
_seriesService = seriesService;
|
||||
}
|
||||
|
||||
protected HistoryResource MapToResource(EpisodeHistory model, bool includeSeries, bool includeEpisode)
|
||||
@ -98,12 +102,24 @@ public List<HistoryResource> GetHistorySince(DateTime date, EpisodeHistoryEventT
|
||||
[Produces("application/json")]
|
||||
public List<HistoryResource> GetSeriesHistory(int seriesId, int? seasonNumber, EpisodeHistoryEventType? eventType = null, bool includeSeries = false, bool includeEpisode = false)
|
||||
{
|
||||
var series = _seriesService.GetSeries(seriesId);
|
||||
|
||||
if (seasonNumber.HasValue)
|
||||
{
|
||||
return _historyService.GetBySeason(seriesId, seasonNumber.Value, eventType).Select(h => MapToResource(h, includeSeries, includeEpisode)).ToList();
|
||||
return _historyService.GetBySeason(seriesId, seasonNumber.Value, eventType).Select(h =>
|
||||
{
|
||||
h.Series = series;
|
||||
|
||||
return MapToResource(h, includeSeries, includeEpisode);
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
return _historyService.GetBySeries(seriesId, eventType).Select(h => MapToResource(h, includeSeries, includeEpisode)).ToList();
|
||||
return _historyService.GetBySeries(seriesId, eventType).Select(h =>
|
||||
{
|
||||
h.Series = series;
|
||||
|
||||
return MapToResource(h, includeSeries, includeEpisode);
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
[HttpPost("failed/{id}")]
|
||||
|
Loading…
Reference in New Issue
Block a user