Removed SeasonService, fixed an issue with episode monitored status

pull/2/head
Mark McDowall 11 years ago
parent 3522ad0547
commit d64e902fa0

@ -9,17 +9,17 @@ namespace NzbDrone.Core.IndexerSearch
{
public class SeriesSearchService : IExecute<SeriesSearchCommand>
{
private readonly ISeasonService _seasonService;
private readonly ISeriesService _seriesService;
private readonly ISearchForNzb _nzbSearchService;
private readonly IDownloadApprovedReports _downloadApprovedReports;
private readonly Logger _logger;
public SeriesSearchService(ISeasonService seasonService,
public SeriesSearchService(ISeriesService seriesService,
ISearchForNzb nzbSearchService,
IDownloadApprovedReports downloadApprovedReports,
Logger logger)
{
_seasonService = seasonService;
_seriesService = seriesService;
_nzbSearchService = nzbSearchService;
_downloadApprovedReports = downloadApprovedReports;
_logger = logger;
@ -27,14 +27,11 @@ namespace NzbDrone.Core.IndexerSearch
public void Execute(SeriesSearchCommand message)
{
var seasons = _seasonService.GetSeasonsBySeries(message.SeriesId)
.Where(s => s.SeasonNumber > 0)
.OrderBy(s => s.SeasonNumber)
.ToList();
var series = _seriesService.GetSeries(message.SeriesId);
var downloadedCount = 0;
foreach (var season in seasons)
foreach (var season in series.Seasons)
{
var decisions = _nzbSearchService.SeasonSearch(message.SeriesId, season.SeasonNumber);
downloadedCount += _downloadApprovedReports.DownloadApproved(decisions).Count;

@ -419,7 +419,6 @@
<Compile Include="Providers\VideoFileInfoReader.cs" />
<Compile Include="Download\Clients\PneumaticClient.cs" />
<Compile Include="MediaFiles\RecycleBinProvider.cs" />
<Compile Include="Tv\SeasonService.cs" />
<Compile Include="SeriesStats\SeriesStatistics.cs" />
<Compile Include="SeriesStats\SeriesStatisticsRepository.cs" />
<Compile Include="Tv\SeriesTypes.cs" />
@ -596,4 +595,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>

@ -15,15 +15,12 @@ namespace NzbDrone.Core.Tv
public class RefreshEpisodeService : IRefreshEpisodeService
{
private readonly IEpisodeService _episodeService;
private readonly ISeasonService _seasonService;
private readonly IMessageAggregator _messageAggregator;
private readonly Logger _logger;
public RefreshEpisodeService(IEpisodeService episodeService,
ISeasonService seasonService, IMessageAggregator messageAggregator, Logger logger)
public RefreshEpisodeService(IEpisodeService episodeService, IMessageAggregator messageAggregator, Logger logger)
{
_episodeService = episodeService;
_seasonService = seasonService;
_messageAggregator = messageAggregator;
_logger = logger;
}
@ -35,7 +32,7 @@ namespace NzbDrone.Core.Tv
var failCount = 0;
var existingEpisodes = _episodeService.GetEpisodeBySeries(series.Id);
var seasons = _seasonService.GetSeasonsBySeries(series.Id);
var seasons = series.Seasons;
var updateList = new List<Episode>();
var newList = new List<Episode>();

@ -79,8 +79,15 @@ namespace NzbDrone.Core.Tv
foreach (var season in seriesInfo.Seasons)
{
var existingSeason = series.Seasons.SingleOrDefault(s => s.SeasonNumber == season.SeasonNumber);
if (existingSeason != null)
//Todo: Should this should use the previous season's monitored state?
if (existingSeason == null)
{
_logger.Trace("New season ({0}) for series: [{1}] {2}, setting monitored to true", season.SeasonNumber, series.TvdbId, series.Title);
season.Monitored = true;
}
else
{
season.Monitored = existingSeason.Monitored;
}

Binary file not shown.

@ -119,11 +119,6 @@ namespace NzbDrone.Core.Tv
public Series UpdateSeries(Series series)
{
foreach (var season in series.Seasons)
{
_episodeService.SetEpisodeMonitoredBySeason(series.Id, season.SeasonNumber, season.Monitored);
}
return _seriesRepository.Update(series);
}

Loading…
Cancel
Save