|
|
@ -47,15 +47,19 @@ namespace NzbDrone.Core.Tv
|
|
|
|
private readonly IEpisodeRepository _episodeRepository;
|
|
|
|
private readonly IEpisodeRepository _episodeRepository;
|
|
|
|
private readonly IEventAggregator _eventAggregator;
|
|
|
|
private readonly IEventAggregator _eventAggregator;
|
|
|
|
private readonly IConfigService _configService;
|
|
|
|
private readonly IConfigService _configService;
|
|
|
|
|
|
|
|
private readonly ISeriesService _seriesService;
|
|
|
|
private readonly Logger _logger;
|
|
|
|
private readonly Logger _logger;
|
|
|
|
|
|
|
|
|
|
|
|
public EpisodeService(IProvideEpisodeInfo episodeInfoProxy, ISeasonRepository seasonRepository, IEpisodeRepository episodeRepository, IEventAggregator eventAggregator, IConfigService configService, Logger logger)
|
|
|
|
public EpisodeService(IProvideEpisodeInfo episodeInfoProxy, ISeasonRepository seasonRepository,
|
|
|
|
|
|
|
|
IEpisodeRepository episodeRepository, IEventAggregator eventAggregator,
|
|
|
|
|
|
|
|
IConfigService configService, ISeriesService seriesService, Logger logger)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_episodeInfoProxy = episodeInfoProxy;
|
|
|
|
_episodeInfoProxy = episodeInfoProxy;
|
|
|
|
_seasonRepository = seasonRepository;
|
|
|
|
_seasonRepository = seasonRepository;
|
|
|
|
_episodeRepository = episodeRepository;
|
|
|
|
_episodeRepository = episodeRepository;
|
|
|
|
_eventAggregator = eventAggregator;
|
|
|
|
_eventAggregator = eventAggregator;
|
|
|
|
_configService = configService;
|
|
|
|
_configService = configService;
|
|
|
|
|
|
|
|
_seriesService = seriesService;
|
|
|
|
_logger = logger;
|
|
|
|
_logger = logger;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -89,7 +93,6 @@ namespace NzbDrone.Core.Tv
|
|
|
|
return _episodeRepository.GetEpisodes(seriesId, seasonNumber);
|
|
|
|
return _episodeRepository.GetEpisodes(seriesId, seasonNumber);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<Episode> EpisodesWithoutFiles(bool includeSpecials)
|
|
|
|
public List<Episode> EpisodesWithoutFiles(bool includeSpecials)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return _episodeRepository.EpisodesWithoutFiles(includeSpecials);
|
|
|
|
return _episodeRepository.EpisodesWithoutFiles(includeSpecials);
|
|
|
@ -111,7 +114,7 @@ namespace NzbDrone.Core.Tv
|
|
|
|
var successCount = 0;
|
|
|
|
var successCount = 0;
|
|
|
|
var failCount = 0;
|
|
|
|
var failCount = 0;
|
|
|
|
|
|
|
|
|
|
|
|
var tvdbEpisodes = _episodeInfoProxy.GetEpisodeInfo(series.TvDbId);
|
|
|
|
var tvdbEpisodes = _episodeInfoProxy.GetEpisodeInfo(series.TvdbId);
|
|
|
|
|
|
|
|
|
|
|
|
var seriesEpisodes = GetEpisodeBySeries(series.Id);
|
|
|
|
var seriesEpisodes = GetEpisodeBySeries(series.Id);
|
|
|
|
var updateList = new List<Episode>();
|
|
|
|
var updateList = new List<Episode>();
|
|
|
@ -281,7 +284,15 @@ namespace NzbDrone.Core.Tv
|
|
|
|
|
|
|
|
|
|
|
|
public List<Episode> EpisodesBetweenDates(DateTime start, DateTime end)
|
|
|
|
public List<Episode> EpisodesBetweenDates(DateTime start, DateTime end)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return _episodeRepository.EpisodesBetweenDates(start.ToUniversalTime(), end.ToUniversalTime());
|
|
|
|
var episodes = _episodeRepository.EpisodesBetweenDates(start.ToUniversalTime(), end.ToUniversalTime());
|
|
|
|
|
|
|
|
var series = _seriesService.GetSeriesInList(episodes.Select(e => e.SeriesId).Distinct());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
episodes.ForEach(e =>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
e.Series = series.SingleOrDefault(s => s.Id == e.SeriesId);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return episodes;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void Handle(EpisodeGrabbedEvent message)
|
|
|
|
public void Handle(EpisodeGrabbedEvent message)
|
|
|
|