mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-05 02:22:31 +01:00
Removed SeasonService, fixed an issue with episode monitored status
This commit is contained in:
parent
3522ad0547
commit
d64e902fa0
Binary file not shown.
@ -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 @@ public SeriesSearchService(ISeasonService seasonService,
|
||||
|
||||
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 @@ public interface IRefreshEpisodeService
|
||||
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 @@ public void RefreshEpisodeInfo(Series series, IEnumerable<Episode> remoteEpisode
|
||||
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 @@ private List<Season> UpdateSeasons(Series series, Series seriesInfo)
|
||||
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 @@ public List<Series> GetAllSeries()
|
||||
|
||||
public Series UpdateSeries(Series series)
|
||||
{
|
||||
foreach (var season in series.Seasons)
|
||||
{
|
||||
_episodeService.SetEpisodeMonitoredBySeason(series.Id, season.SeasonNumber, season.Monitored);
|
||||
}
|
||||
|
||||
return _seriesRepository.Update(series);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user