Fixed: Cutoff unmet searches rejecting releases incorrectly
This commit is contained in:
parent
4ddf4a22a3
commit
e23a879669
|
@ -100,7 +100,15 @@ class CutoffUnmet extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
onSearchAllCutoffUnmetConfirmed = () => {
|
onSearchAllCutoffUnmetConfirmed = () => {
|
||||||
this.props.onSearchAllCutoffUnmetPress();
|
const {
|
||||||
|
selectedFilterKey,
|
||||||
|
onSearchAllCutoffUnmetPress
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
|
// TODO: Custom filters will need to check whether there is a monitored
|
||||||
|
// filter once implemented.
|
||||||
|
|
||||||
|
onSearchAllCutoffUnmetPress(selectedFilterKey === 'monitored');
|
||||||
this.setState({ isConfirmSearchAllCutoffUnmetModalOpen: false });
|
this.setState({ isConfirmSearchAllCutoffUnmetModalOpen: false });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -130,9 +130,10 @@ class CutoffUnmetConnector extends Component {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onSearchAllCutoffUnmetPress = () => {
|
onSearchAllCutoffUnmetPress = (monitored) => {
|
||||||
this.props.executeCommand({
|
this.props.executeCommand({
|
||||||
name: commandNames.CUTOFF_UNMET_EPISODE_SEARCH
|
name: commandNames.CUTOFF_UNMET_EPISODE_SEARCH,
|
||||||
|
monitored
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,15 @@ class Missing extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
onSearchAllMissingConfirmed = () => {
|
onSearchAllMissingConfirmed = () => {
|
||||||
this.props.onSearchAllMissingPress();
|
const {
|
||||||
|
selectedFilterKey,
|
||||||
|
onSearchAllMissingPress
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
|
// TODO: Custom filters will need to check whether there is a monitored
|
||||||
|
// filter once implemented.
|
||||||
|
|
||||||
|
onSearchAllMissingPress(selectedFilterKey === 'monitored');
|
||||||
this.setState({ isConfirmSearchAllMissingModalOpen: false });
|
this.setState({ isConfirmSearchAllMissingModalOpen: false });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -121,9 +121,10 @@ class MissingConnector extends Component {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onSearchAllMissingPress = () => {
|
onSearchAllMissingPress = (monitored) => {
|
||||||
this.props.executeCommand({
|
this.props.executeCommand({
|
||||||
name: commandNames.MISSING_EPISODE_SEARCH
|
name: commandNames.MISSING_EPISODE_SEARCH,
|
||||||
|
monitored
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -152,7 +152,7 @@ namespace NzbDrone.Core.Test.IndexerSearchTests
|
||||||
|
|
||||||
var allCriteria = WatchForSearchCriteria();
|
var allCriteria = WatchForSearchCriteria();
|
||||||
|
|
||||||
Subject.SeasonSearch(_xemSeries.Id, 1, false, true, false);
|
Subject.SeasonSearch(_xemSeries.Id, 1, false, false, true, false);
|
||||||
|
|
||||||
var criteria = allCriteria.OfType<SeasonSearchCriteria>().ToList();
|
var criteria = allCriteria.OfType<SeasonSearchCriteria>().ToList();
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ namespace NzbDrone.Core.Test.IndexerSearchTests
|
||||||
|
|
||||||
var allCriteria = WatchForSearchCriteria();
|
var allCriteria = WatchForSearchCriteria();
|
||||||
|
|
||||||
Subject.SeasonSearch(_xemSeries.Id, 2, false, true, false);
|
Subject.SeasonSearch(_xemSeries.Id, 2, false, false, true, false);
|
||||||
|
|
||||||
var criteria = allCriteria.OfType<SeasonSearchCriteria>().ToList();
|
var criteria = allCriteria.OfType<SeasonSearchCriteria>().ToList();
|
||||||
|
|
||||||
|
@ -183,7 +183,7 @@ namespace NzbDrone.Core.Test.IndexerSearchTests
|
||||||
|
|
||||||
var allCriteria = WatchForSearchCriteria();
|
var allCriteria = WatchForSearchCriteria();
|
||||||
|
|
||||||
Subject.SeasonSearch(_xemSeries.Id, 4, false, true, false);
|
Subject.SeasonSearch(_xemSeries.Id, 4, false, false, true, false);
|
||||||
|
|
||||||
var criteria1 = allCriteria.OfType<SeasonSearchCriteria>().ToList();
|
var criteria1 = allCriteria.OfType<SeasonSearchCriteria>().ToList();
|
||||||
var criteria2 = allCriteria.OfType<SingleEpisodeSearchCriteria>().ToList();
|
var criteria2 = allCriteria.OfType<SingleEpisodeSearchCriteria>().ToList();
|
||||||
|
@ -203,7 +203,7 @@ namespace NzbDrone.Core.Test.IndexerSearchTests
|
||||||
|
|
||||||
var allCriteria = WatchForSearchCriteria();
|
var allCriteria = WatchForSearchCriteria();
|
||||||
|
|
||||||
Subject.SeasonSearch(_xemSeries.Id, 7, false, true, false);
|
Subject.SeasonSearch(_xemSeries.Id, 7, false, false, true, false);
|
||||||
|
|
||||||
var criteria = allCriteria.OfType<SeasonSearchCriteria>().ToList();
|
var criteria = allCriteria.OfType<SeasonSearchCriteria>().ToList();
|
||||||
|
|
||||||
|
@ -221,7 +221,7 @@ namespace NzbDrone.Core.Test.IndexerSearchTests
|
||||||
var seasonNumber = 1;
|
var seasonNumber = 1;
|
||||||
var allCriteria = WatchForSearchCriteria();
|
var allCriteria = WatchForSearchCriteria();
|
||||||
|
|
||||||
Subject.SeasonSearch(_xemSeries.Id, seasonNumber, true, true, false);
|
Subject.SeasonSearch(_xemSeries.Id, seasonNumber, true, false, true, false);
|
||||||
|
|
||||||
var criteria = allCriteria.OfType<AnimeEpisodeSearchCriteria>().ToList();
|
var criteria = allCriteria.OfType<AnimeEpisodeSearchCriteria>().ToList();
|
||||||
|
|
||||||
|
@ -239,7 +239,7 @@ namespace NzbDrone.Core.Test.IndexerSearchTests
|
||||||
var seasonNumber = 1;
|
var seasonNumber = 1;
|
||||||
var allCriteria = WatchForSearchCriteria();
|
var allCriteria = WatchForSearchCriteria();
|
||||||
|
|
||||||
Subject.SeasonSearch(_xemSeries.Id, seasonNumber, false, true, false);
|
Subject.SeasonSearch(_xemSeries.Id, seasonNumber, false, false, true, false);
|
||||||
|
|
||||||
var criteria = allCriteria.OfType<AnimeEpisodeSearchCriteria>().ToList();
|
var criteria = allCriteria.OfType<AnimeEpisodeSearchCriteria>().ToList();
|
||||||
|
|
||||||
|
@ -257,7 +257,7 @@ namespace NzbDrone.Core.Test.IndexerSearchTests
|
||||||
var seasonNumber = 1;
|
var seasonNumber = 1;
|
||||||
var allCriteria = WatchForSearchCriteria();
|
var allCriteria = WatchForSearchCriteria();
|
||||||
|
|
||||||
Subject.SeasonSearch(_xemSeries.Id, seasonNumber, false, true, false);
|
Subject.SeasonSearch(_xemSeries.Id, seasonNumber, false, false, true, false);
|
||||||
|
|
||||||
var criteria = allCriteria.OfType<AnimeEpisodeSearchCriteria>().ToList();
|
var criteria = allCriteria.OfType<AnimeEpisodeSearchCriteria>().ToList();
|
||||||
|
|
||||||
|
@ -274,7 +274,7 @@ namespace NzbDrone.Core.Test.IndexerSearchTests
|
||||||
var seasonNumber = 1;
|
var seasonNumber = 1;
|
||||||
var allCriteria = WatchForSearchCriteria();
|
var allCriteria = WatchForSearchCriteria();
|
||||||
|
|
||||||
Subject.SeasonSearch(_xemSeries.Id, seasonNumber, true, true, false);
|
Subject.SeasonSearch(_xemSeries.Id, seasonNumber, true, false, true, false);
|
||||||
|
|
||||||
var criteria = allCriteria.OfType<AnimeEpisodeSearchCriteria>().ToList();
|
var criteria = allCriteria.OfType<AnimeEpisodeSearchCriteria>().ToList();
|
||||||
|
|
||||||
|
@ -291,7 +291,7 @@ namespace NzbDrone.Core.Test.IndexerSearchTests
|
||||||
var seasonNumber = 1;
|
var seasonNumber = 1;
|
||||||
var allCriteria = WatchForSearchCriteria();
|
var allCriteria = WatchForSearchCriteria();
|
||||||
|
|
||||||
Subject.SeasonSearch(_xemSeries.Id, seasonNumber, true, true, false);
|
Subject.SeasonSearch(_xemSeries.Id, seasonNumber, true, false, true, false);
|
||||||
|
|
||||||
var criteria = allCriteria.OfType<AnimeEpisodeSearchCriteria>().ToList();
|
var criteria = allCriteria.OfType<AnimeEpisodeSearchCriteria>().ToList();
|
||||||
|
|
||||||
|
@ -310,7 +310,7 @@ namespace NzbDrone.Core.Test.IndexerSearchTests
|
||||||
|
|
||||||
var allCriteria = WatchForSearchCriteria();
|
var allCriteria = WatchForSearchCriteria();
|
||||||
|
|
||||||
Subject.SeasonSearch(_xemSeries.Id, 1, false, true, false);
|
Subject.SeasonSearch(_xemSeries.Id, 1, false, false, true, false);
|
||||||
|
|
||||||
var criteria = allCriteria.OfType<DailySeasonSearchCriteria>().ToList();
|
var criteria = allCriteria.OfType<DailySeasonSearchCriteria>().ToList();
|
||||||
|
|
||||||
|
@ -329,7 +329,7 @@ namespace NzbDrone.Core.Test.IndexerSearchTests
|
||||||
|
|
||||||
var allCriteria = WatchForSearchCriteria();
|
var allCriteria = WatchForSearchCriteria();
|
||||||
|
|
||||||
Subject.SeasonSearch(_xemSeries.Id, 1, false, true, false);
|
Subject.SeasonSearch(_xemSeries.Id, 1, false, false, true, false);
|
||||||
|
|
||||||
var criteria1 = allCriteria.OfType<DailySeasonSearchCriteria>().ToList();
|
var criteria1 = allCriteria.OfType<DailySeasonSearchCriteria>().ToList();
|
||||||
var criteria2 = allCriteria.OfType<DailyEpisodeSearchCriteria>().ToList();
|
var criteria2 = allCriteria.OfType<DailyEpisodeSearchCriteria>().ToList();
|
||||||
|
@ -352,7 +352,7 @@ namespace NzbDrone.Core.Test.IndexerSearchTests
|
||||||
|
|
||||||
var allCriteria = WatchForSearchCriteria();
|
var allCriteria = WatchForSearchCriteria();
|
||||||
|
|
||||||
Subject.SeasonSearch(_xemSeries.Id, 1, false, true, false);
|
Subject.SeasonSearch(_xemSeries.Id, 1, false, false, true, false);
|
||||||
|
|
||||||
var criteria1 = allCriteria.OfType<DailySeasonSearchCriteria>().ToList();
|
var criteria1 = allCriteria.OfType<DailySeasonSearchCriteria>().ToList();
|
||||||
var criteria2 = allCriteria.OfType<DailyEpisodeSearchCriteria>().ToList();
|
var criteria2 = allCriteria.OfType<DailyEpisodeSearchCriteria>().ToList();
|
||||||
|
@ -368,7 +368,7 @@ namespace NzbDrone.Core.Test.IndexerSearchTests
|
||||||
|
|
||||||
var allCriteria = WatchForSearchCriteria();
|
var allCriteria = WatchForSearchCriteria();
|
||||||
|
|
||||||
Subject.SeasonSearch(_xemSeries.Id, 7, false, true, false);
|
Subject.SeasonSearch(_xemSeries.Id, 7, false, false, true, false);
|
||||||
|
|
||||||
Mocker.GetMock<ISceneMappingService>()
|
Mocker.GetMock<ISceneMappingService>()
|
||||||
.Verify(v => v.GetSceneNames(_xemSeries.Id, It.Is<List<int>>(l => l.Contains(7)), It.Is<List<int>>(l => l.Contains(7))), Times.Once());
|
.Verify(v => v.GetSceneNames(_xemSeries.Id, It.Is<List<int>>(l => l.Contains(7)), It.Is<List<int>>(l => l.Contains(7))), Times.Once());
|
||||||
|
|
|
@ -32,7 +32,7 @@ namespace NzbDrone.Core.Test.IndexerSearchTests
|
||||||
.Returns(_series);
|
.Returns(_series);
|
||||||
|
|
||||||
Mocker.GetMock<ISearchForNzb>()
|
Mocker.GetMock<ISearchForNzb>()
|
||||||
.Setup(s => s.SeasonSearch(_series.Id, It.IsAny<int>(), false, true, false))
|
.Setup(s => s.SeasonSearch(_series.Id, It.IsAny<int>(), false, false, true, false))
|
||||||
.Returns(new List<DownloadDecision>());
|
.Returns(new List<DownloadDecision>());
|
||||||
|
|
||||||
Mocker.GetMock<IProcessDownloadDecisions>()
|
Mocker.GetMock<IProcessDownloadDecisions>()
|
||||||
|
@ -52,7 +52,7 @@ namespace NzbDrone.Core.Test.IndexerSearchTests
|
||||||
Subject.Execute(new SeriesSearchCommand { SeriesId = _series.Id, Trigger = CommandTrigger.Manual });
|
Subject.Execute(new SeriesSearchCommand { SeriesId = _series.Id, Trigger = CommandTrigger.Manual });
|
||||||
|
|
||||||
Mocker.GetMock<ISearchForNzb>()
|
Mocker.GetMock<ISearchForNzb>()
|
||||||
.Verify(v => v.SeasonSearch(_series.Id, It.IsAny<int>(), false, true, false), Times.Exactly(_series.Seasons.Count(s => s.Monitored)));
|
.Verify(v => v.SeasonSearch(_series.Id, It.IsAny<int>(), false, true, true, false), Times.Exactly(_series.Seasons.Count(s => s.Monitored)));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -68,9 +68,9 @@ namespace NzbDrone.Core.Test.IndexerSearchTests
|
||||||
};
|
};
|
||||||
|
|
||||||
Mocker.GetMock<ISearchForNzb>()
|
Mocker.GetMock<ISearchForNzb>()
|
||||||
.Setup(s => s.SeasonSearch(_series.Id, It.IsAny<int>(), false, true, false))
|
.Setup(s => s.SeasonSearch(_series.Id, It.IsAny<int>(), false, true, true, false))
|
||||||
.Returns(new List<DownloadDecision>())
|
.Returns(new List<DownloadDecision>())
|
||||||
.Callback<int, int, bool, bool, bool>((seriesId, seasonNumber, missingOnly, userInvokedSearch, interactiveSearch) => seasonOrder.Add(seasonNumber));
|
.Callback<int, int, bool, bool, bool, bool>((seriesId, seasonNumber, missingOnly, monitoredOnly, userInvokedSearch, interactiveSearch) => seasonOrder.Add(seasonNumber));
|
||||||
|
|
||||||
Subject.Execute(new SeriesSearchCommand { SeriesId = _series.Id, Trigger = CommandTrigger.Manual });
|
Subject.Execute(new SeriesSearchCommand { SeriesId = _series.Id, Trigger = CommandTrigger.Manual });
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ namespace NzbDrone.Core.IndexerSearch
|
||||||
public class CutoffUnmetEpisodeSearchCommand : Command
|
public class CutoffUnmetEpisodeSearchCommand : Command
|
||||||
{
|
{
|
||||||
public int? SeriesId { get; set; }
|
public int? SeriesId { get; set; }
|
||||||
|
public bool Monitored { get; set; }
|
||||||
|
|
||||||
public override bool SendUpdatesToClient
|
public override bool SendUpdatesToClient
|
||||||
{
|
{
|
||||||
|
@ -16,11 +17,13 @@ namespace NzbDrone.Core.IndexerSearch
|
||||||
|
|
||||||
public CutoffUnmetEpisodeSearchCommand()
|
public CutoffUnmetEpisodeSearchCommand()
|
||||||
{
|
{
|
||||||
|
Monitored = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CutoffUnmetEpisodeSearchCommand(int seriesId)
|
public CutoffUnmetEpisodeSearchCommand(int seriesId)
|
||||||
{
|
{
|
||||||
SeriesId = seriesId;
|
SeriesId = seriesId;
|
||||||
|
Monitored = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -4,8 +4,6 @@ namespace NzbDrone.Core.IndexerSearch.Definitions
|
||||||
{
|
{
|
||||||
public int SeasonNumber { get; set; }
|
public int SeasonNumber { get; set; }
|
||||||
|
|
||||||
public override bool MonitoredEpisodesOnly => true;
|
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return string.Format("[{0} : S{1:00}]", Series.Title, SeasonNumber);
|
return string.Format("[{0} : S{1:00}]", Series.Title, SeasonNumber);
|
||||||
|
|
|
@ -40,9 +40,9 @@ namespace NzbDrone.Core.IndexerSearch
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SearchForMissingEpisodes(List<Episode> episodes, bool userInvokedSearch)
|
private void SearchForEpisodes(List<Episode> episodes, bool monitoredOnly, bool userInvokedSearch)
|
||||||
{
|
{
|
||||||
_logger.ProgressInfo("Performing missing search for {0} episodes", episodes.Count);
|
_logger.ProgressInfo("Performing search for {0} episodes", episodes.Count);
|
||||||
var downloadedCount = 0;
|
var downloadedCount = 0;
|
||||||
|
|
||||||
foreach (var series in episodes.GroupBy(e => e.SeriesId))
|
foreach (var series in episodes.GroupBy(e => e.SeriesId))
|
||||||
|
@ -55,11 +55,11 @@ namespace NzbDrone.Core.IndexerSearch
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
decisions = _nzbSearchService.SeasonSearch(series.Key, season.Key, true, userInvokedSearch, false);
|
decisions = _nzbSearchService.SeasonSearch(series.Key, season.Key, season.ToList(), monitoredOnly, userInvokedSearch, false);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.Error(ex, "Unable to search for missing episodes in season {0} of [{1}]", season.Key, series.Key);
|
_logger.Error(ex, "Unable to search for episodes in season {0} of [{1}]", season.Key, series.Key);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ namespace NzbDrone.Core.IndexerSearch
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.Error(ex, "Unable to search for missing episode: [{0}]", season.First());
|
_logger.Error(ex, "Unable to search for episode: [{0}]", season.First());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -83,7 +83,12 @@ namespace NzbDrone.Core.IndexerSearch
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_logger.ProgressInfo("Completed missing search for {0} episodes. {1} reports downloaded.", episodes.Count, downloadedCount);
|
_logger.ProgressInfo("Completed search for {0} episodes. {1} reports downloaded.", episodes.Count, downloadedCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool IsMonitored(bool episodeMonitored, bool seriesMonitored)
|
||||||
|
{
|
||||||
|
return episodeMonitored && seriesMonitored;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Execute(EpisodeSearchCommand message)
|
public void Execute(EpisodeSearchCommand message)
|
||||||
|
@ -99,12 +104,13 @@ namespace NzbDrone.Core.IndexerSearch
|
||||||
|
|
||||||
public void Execute(MissingEpisodeSearchCommand message)
|
public void Execute(MissingEpisodeSearchCommand message)
|
||||||
{
|
{
|
||||||
|
var monitored = message.Monitored;
|
||||||
List<Episode> episodes;
|
List<Episode> episodes;
|
||||||
|
|
||||||
if (message.SeriesId.HasValue)
|
if (message.SeriesId.HasValue)
|
||||||
{
|
{
|
||||||
episodes = _episodeService.GetEpisodeBySeries(message.SeriesId.Value)
|
episodes = _episodeService.GetEpisodeBySeries(message.SeriesId.Value)
|
||||||
.Where(e => e.Monitored &&
|
.Where(e => e.Monitored == monitored &&
|
||||||
!e.HasFile &&
|
!e.HasFile &&
|
||||||
e.AirDateUtc.HasValue &&
|
e.AirDateUtc.HasValue &&
|
||||||
e.AirDateUtc.Value.Before(DateTime.UtcNow))
|
e.AirDateUtc.Value.Before(DateTime.UtcNow))
|
||||||
|
@ -121,7 +127,14 @@ namespace NzbDrone.Core.IndexerSearch
|
||||||
SortKey = "Id"
|
SortKey = "Id"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (monitored)
|
||||||
|
{
|
||||||
pagingSpec.FilterExpressions.Add(v => v.Monitored == true && v.Series.Monitored == true);
|
pagingSpec.FilterExpressions.Add(v => v.Monitored == true && v.Series.Monitored == true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pagingSpec.FilterExpressions.Add(v => v.Monitored == false || v.Series.Monitored == false);
|
||||||
|
}
|
||||||
|
|
||||||
episodes = _episodeService.EpisodesWithoutFiles(pagingSpec).Records.ToList();
|
episodes = _episodeService.EpisodesWithoutFiles(pagingSpec).Records.ToList();
|
||||||
}
|
}
|
||||||
|
@ -129,27 +142,12 @@ namespace NzbDrone.Core.IndexerSearch
|
||||||
var queue = _queueService.GetQueue().Where(q => q.Episode != null).Select(q => q.Episode.Id);
|
var queue = _queueService.GetQueue().Where(q => q.Episode != null).Select(q => q.Episode.Id);
|
||||||
var missing = episodes.Where(e => !queue.Contains(e.Id)).ToList();
|
var missing = episodes.Where(e => !queue.Contains(e.Id)).ToList();
|
||||||
|
|
||||||
SearchForMissingEpisodes(missing, message.Trigger == CommandTrigger.Manual);
|
SearchForEpisodes(missing, monitored, message.Trigger == CommandTrigger.Manual);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Execute(CutoffUnmetEpisodeSearchCommand message)
|
public void Execute(CutoffUnmetEpisodeSearchCommand message)
|
||||||
{
|
{
|
||||||
Expression<Func<Episode, bool>> filterExpression;
|
var monitored = message.Monitored;
|
||||||
|
|
||||||
if (message.SeriesId.HasValue)
|
|
||||||
{
|
|
||||||
filterExpression = v =>
|
|
||||||
v.SeriesId == message.SeriesId.Value &&
|
|
||||||
v.Monitored == true &&
|
|
||||||
v.Series.Monitored == true;
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
filterExpression = v =>
|
|
||||||
v.Monitored == true &&
|
|
||||||
v.Series.Monitored == true;
|
|
||||||
}
|
|
||||||
|
|
||||||
var pagingSpec = new PagingSpec<Episode>
|
var pagingSpec = new PagingSpec<Episode>
|
||||||
{
|
{
|
||||||
|
@ -159,14 +157,25 @@ namespace NzbDrone.Core.IndexerSearch
|
||||||
SortKey = "Id"
|
SortKey = "Id"
|
||||||
};
|
};
|
||||||
|
|
||||||
pagingSpec.FilterExpressions.Add(filterExpression);
|
if (message.SeriesId.HasValue)
|
||||||
|
{
|
||||||
|
pagingSpec.FilterExpressions.Add(v => v.SeriesId == message.SeriesId.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (monitored)
|
||||||
|
{
|
||||||
|
pagingSpec.FilterExpressions.Add(v => v.Monitored == true && v.Series.Monitored == true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pagingSpec.FilterExpressions.Add(v => v.Monitored == false || v.Series.Monitored == false);
|
||||||
|
}
|
||||||
|
|
||||||
var episodes = _episodeCutoffService.EpisodesWhereCutoffUnmet(pagingSpec).Records.ToList();
|
var episodes = _episodeCutoffService.EpisodesWhereCutoffUnmet(pagingSpec).Records.ToList();
|
||||||
|
|
||||||
var queue = _queueService.GetQueue().Where(q => q.Episode != null).Select(q => q.Episode.Id);
|
var queue = _queueService.GetQueue().Where(q => q.Episode != null).Select(q => q.Episode.Id);
|
||||||
var missing = episodes.Where(e => !queue.Contains(e.Id)).ToList();
|
var cutoffUnmet = episodes.Where(e => !queue.Contains(e.Id)).ToList();
|
||||||
|
|
||||||
SearchForMissingEpisodes(missing, message.Trigger == CommandTrigger.Manual);
|
SearchForEpisodes(cutoffUnmet, monitored, message.Trigger == CommandTrigger.Manual);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,16 +5,19 @@ namespace NzbDrone.Core.IndexerSearch
|
||||||
public class MissingEpisodeSearchCommand : Command
|
public class MissingEpisodeSearchCommand : Command
|
||||||
{
|
{
|
||||||
public int? SeriesId { get; set; }
|
public int? SeriesId { get; set; }
|
||||||
|
public bool Monitored { get; set; }
|
||||||
|
|
||||||
public override bool SendUpdatesToClient => true;
|
public override bool SendUpdatesToClient => true;
|
||||||
|
|
||||||
public MissingEpisodeSearchCommand()
|
public MissingEpisodeSearchCommand()
|
||||||
{
|
{
|
||||||
|
Monitored = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MissingEpisodeSearchCommand(int seriesId)
|
public MissingEpisodeSearchCommand(int seriesId)
|
||||||
{
|
{
|
||||||
SeriesId = seriesId;
|
SeriesId = seriesId;
|
||||||
|
Monitored = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -21,7 +21,8 @@ namespace NzbDrone.Core.IndexerSearch
|
||||||
{
|
{
|
||||||
List<DownloadDecision> EpisodeSearch(int episodeId, bool userInvokedSearch, bool interactiveSearch);
|
List<DownloadDecision> EpisodeSearch(int episodeId, bool userInvokedSearch, bool interactiveSearch);
|
||||||
List<DownloadDecision> EpisodeSearch(Episode episode, bool userInvokedSearch, bool interactiveSearch);
|
List<DownloadDecision> EpisodeSearch(Episode episode, bool userInvokedSearch, bool interactiveSearch);
|
||||||
List<DownloadDecision> SeasonSearch(int seriesId, int seasonNumber, bool missingOnly, bool userInvokedSearch, bool interactiveSearch);
|
List<DownloadDecision> SeasonSearch(int seriesId, int seasonNumber, bool missingOnly, bool monitoredOnly, bool userInvokedSearch, bool interactiveSearch);
|
||||||
|
List<DownloadDecision> SeasonSearch(int seriesId, int seasonNumber, List<Episode> episodes, bool monitoredOnly, bool userInvokedSearch, bool interactiveSearch);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class NzbSearchService : ISearchForNzb
|
public class NzbSearchService : ISearchForNzb
|
||||||
|
@ -83,16 +84,21 @@ namespace NzbDrone.Core.IndexerSearch
|
||||||
return SearchSingle(series, episode, userInvokedSearch, interactiveSearch);
|
return SearchSingle(series, episode, userInvokedSearch, interactiveSearch);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<DownloadDecision> SeasonSearch(int seriesId, int seasonNumber, bool missingOnly, bool userInvokedSearch, bool interactiveSearch)
|
public List<DownloadDecision> SeasonSearch(int seriesId, int seasonNumber, bool missingOnly, bool monitoredOnly, bool userInvokedSearch, bool interactiveSearch)
|
||||||
{
|
{
|
||||||
var series = _seriesService.GetSeries(seriesId);
|
|
||||||
var episodes = _episodeService.GetEpisodesBySeason(seriesId, seasonNumber);
|
var episodes = _episodeService.GetEpisodesBySeason(seriesId, seasonNumber);
|
||||||
|
|
||||||
if (missingOnly)
|
if (missingOnly)
|
||||||
{
|
{
|
||||||
episodes = episodes.Where(e => e.Monitored && !e.HasFile).ToList();
|
episodes = episodes.Where(e => !e.HasFile).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return SeasonSearch(seriesId, seasonNumber, episodes, monitoredOnly, userInvokedSearch, interactiveSearch);
|
||||||
|
}
|
||||||
|
public List<DownloadDecision> SeasonSearch(int seriesId, int seasonNumber, List<Episode> episodes, bool monitoredOnly, bool userInvokedSearch, bool interactiveSearch)
|
||||||
|
{
|
||||||
|
var series = _seriesService.GetSeries(seriesId);
|
||||||
|
|
||||||
if (series.SeriesType == SeriesTypes.Anime)
|
if (series.SeriesType == SeriesTypes.Anime)
|
||||||
{
|
{
|
||||||
return SearchAnimeSeason(series, episodes, userInvokedSearch, interactiveSearch);
|
return SearchAnimeSeason(series, episodes, userInvokedSearch, interactiveSearch);
|
||||||
|
@ -130,7 +136,7 @@ namespace NzbDrone.Core.IndexerSearch
|
||||||
var searchSpec = Get<SingleEpisodeSearchCriteria>(series, sceneSeasonEpisodes.ToList(), userInvokedSearch, interactiveSearch);
|
var searchSpec = Get<SingleEpisodeSearchCriteria>(series, sceneSeasonEpisodes.ToList(), userInvokedSearch, interactiveSearch);
|
||||||
|
|
||||||
searchSpec.SeasonNumber = sceneSeasonEpisodes.Key;
|
searchSpec.SeasonNumber = sceneSeasonEpisodes.Key;
|
||||||
searchSpec.MonitoredEpisodesOnly = true;
|
searchSpec.MonitoredEpisodesOnly = monitoredOnly;
|
||||||
|
|
||||||
if (episode.SceneSeasonNumber.HasValue && episode.SceneEpisodeNumber.HasValue)
|
if (episode.SceneSeasonNumber.HasValue && episode.SceneEpisodeNumber.HasValue)
|
||||||
{
|
{
|
||||||
|
@ -148,6 +154,7 @@ namespace NzbDrone.Core.IndexerSearch
|
||||||
{
|
{
|
||||||
var searchSpec = Get<SeasonSearchCriteria>(series, sceneSeasonEpisodes.ToList(), userInvokedSearch, interactiveSearch);
|
var searchSpec = Get<SeasonSearchCriteria>(series, sceneSeasonEpisodes.ToList(), userInvokedSearch, interactiveSearch);
|
||||||
searchSpec.SeasonNumber = sceneSeasonEpisodes.Key;
|
searchSpec.SeasonNumber = sceneSeasonEpisodes.Key;
|
||||||
|
searchSpec.MonitoredEpisodesOnly = monitoredOnly;
|
||||||
|
|
||||||
var decisions = Dispatch(indexer => indexer.Fetch(searchSpec), searchSpec);
|
var decisions = Dispatch(indexer => indexer.Fetch(searchSpec), searchSpec);
|
||||||
downloadDecisions.AddRange(decisions);
|
downloadDecisions.AddRange(decisions);
|
||||||
|
@ -158,6 +165,7 @@ namespace NzbDrone.Core.IndexerSearch
|
||||||
{
|
{
|
||||||
var searchSpec = Get<SeasonSearchCriteria>(series, episodes, userInvokedSearch, interactiveSearch);
|
var searchSpec = Get<SeasonSearchCriteria>(series, episodes, userInvokedSearch, interactiveSearch);
|
||||||
searchSpec.SeasonNumber = seasonNumber;
|
searchSpec.SeasonNumber = seasonNumber;
|
||||||
|
searchSpec.MonitoredEpisodesOnly = monitoredOnly;
|
||||||
|
|
||||||
var decisions = Dispatch(indexer => indexer.Fetch(searchSpec), searchSpec);
|
var decisions = Dispatch(indexer => indexer.Fetch(searchSpec), searchSpec);
|
||||||
downloadDecisions.AddRange(decisions);
|
downloadDecisions.AddRange(decisions);
|
||||||
|
|
|
@ -22,7 +22,7 @@ namespace NzbDrone.Core.IndexerSearch
|
||||||
|
|
||||||
public void Execute(SeasonSearchCommand message)
|
public void Execute(SeasonSearchCommand message)
|
||||||
{
|
{
|
||||||
var decisions = _nzbSearchService.SeasonSearch(message.SeriesId, message.SeasonNumber, false, message.Trigger == CommandTrigger.Manual, false);
|
var decisions = _nzbSearchService.SeasonSearch(message.SeriesId, message.SeasonNumber, false, true, message.Trigger == CommandTrigger.Manual, false);
|
||||||
var processed = _processDownloadDecisions.ProcessDecisions(decisions);
|
var processed = _processDownloadDecisions.ProcessDecisions(decisions);
|
||||||
|
|
||||||
_logger.ProgressInfo("Season search completed. {0} reports downloaded.", processed.Grabbed.Count);
|
_logger.ProgressInfo("Season search completed. {0} reports downloaded.", processed.Grabbed.Count);
|
||||||
|
|
|
@ -39,7 +39,7 @@ namespace NzbDrone.Core.IndexerSearch
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var decisions = _nzbSearchService.SeasonSearch(message.SeriesId, season.SeasonNumber, false, message.Trigger == CommandTrigger.Manual, false);
|
var decisions = _nzbSearchService.SeasonSearch(message.SeriesId, season.SeasonNumber, false, true, message.Trigger == CommandTrigger.Manual, false);
|
||||||
downloadedCount += _processDownloadDecisions.ProcessDecisions(decisions).Grabbed.Count;
|
downloadedCount += _processDownloadDecisions.ProcessDecisions(decisions).Grabbed.Count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -171,7 +171,7 @@ namespace Sonarr.Api.V3.Indexers
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var decisions = _nzbSearchService.SeasonSearch(seriesId, seasonNumber, false, true, true);
|
var decisions = _nzbSearchService.SeasonSearch(seriesId, seasonNumber, false, false, true, true);
|
||||||
var prioritizedDecisions = _prioritizeDownloadDecision.PrioritizeDecisions(decisions);
|
var prioritizedDecisions = _prioritizeDownloadDecision.PrioritizeDecisions(decisions);
|
||||||
|
|
||||||
return MapDecisions(prioritizedDecisions);
|
return MapDecisions(prioritizedDecisions);
|
||||||
|
|
Loading…
Reference in New Issue