Fixed: Duplicate searches when Anime Standard Format Search enabled on indexer and series has multiple aliases

This commit is contained in:
Mark McDowall 2023-08-03 17:22:47 -07:00
parent 377fce6fe1
commit d581de00c9
2 changed files with 19 additions and 11 deletions

View File

@ -157,8 +157,8 @@ namespace NzbDrone.Core.Test.IndexerTests.NewznabTests
var pages = results.GetTier(0).Select(t => t.First()).ToList(); var pages = results.GetTier(0).Select(t => t.First()).ToList();
pages[0].Url.FullUri.Should().Contain("rid=10&q=100"); pages[0].Url.FullUri.Should().Contain("rid=10&q=100");
pages[1].Url.FullUri.Should().Contain("q=Monkey%20Island+100"); pages[1].Url.FullUri.Should().Contain("rid=10&season=5&ep=4");
pages[2].Url.FullUri.Should().Contain("rid=10&season=5&ep=4"); pages[2].Url.FullUri.Should().Contain("q=Monkey%20Island+100");
pages[3].Url.FullUri.Should().Contain("q=Monkey%20Island&season=5&ep=4"); pages[3].Url.FullUri.Should().Contain("q=Monkey%20Island&season=5&ep=4");
} }

View File

@ -390,27 +390,35 @@ namespace NzbDrone.Core.Indexers.Newznab
var pageableRequests = new IndexerPageableRequestChain(); var pageableRequests = new IndexerPageableRequestChain();
if (SupportsSearch) if (SupportsSearch)
{
var queryTitles = TextSearchEngine == "raw" ? searchCriteria.SceneTitles : searchCriteria.CleanSceneTitles;
foreach (var queryTitle in queryTitles)
{ {
AddTvIdPageableRequests(pageableRequests, AddTvIdPageableRequests(pageableRequests,
Settings.AnimeCategories, Settings.AnimeCategories,
searchCriteria, searchCriteria,
$"&q={searchCriteria.AbsoluteEpisodeNumber:00}"); $"&q={searchCriteria.AbsoluteEpisodeNumber:00}");
pageableRequests.Add(GetPagedRequests(MaxPages, var includeAnimeStandardFormatSearch = Settings.AnimeStandardFormatSearch &&
Settings.AnimeCategories, searchCriteria.SeasonNumber > 0 &&
"search", searchCriteria.EpisodeNumber > 0;
$"&q={NewsnabifyTitle(queryTitle)}+{searchCriteria.AbsoluteEpisodeNumber:00}"));
if (Settings.AnimeStandardFormatSearch && searchCriteria.SeasonNumber > 0 && searchCriteria.EpisodeNumber > 0) if (includeAnimeStandardFormatSearch)
{ {
AddTvIdPageableRequests(pageableRequests, AddTvIdPageableRequests(pageableRequests,
Settings.AnimeCategories, Settings.AnimeCategories,
searchCriteria, searchCriteria,
$"&season={NewznabifySeasonNumber(searchCriteria.SeasonNumber)}&ep={searchCriteria.EpisodeNumber}"); $"&season={NewznabifySeasonNumber(searchCriteria.SeasonNumber)}&ep={searchCriteria.EpisodeNumber}");
}
var queryTitles = TextSearchEngine == "raw" ? searchCriteria.SceneTitles : searchCriteria.CleanSceneTitles;
foreach (var queryTitle in queryTitles)
{
pageableRequests.Add(GetPagedRequests(MaxPages,
Settings.AnimeCategories,
"search",
$"&q={NewsnabifyTitle(queryTitle)}+{searchCriteria.AbsoluteEpisodeNumber:00}"));
if (includeAnimeStandardFormatSearch)
{
pageableRequests.Add(GetPagedRequests(MaxPages, pageableRequests.Add(GetPagedRequests(MaxPages,
Settings.AnimeCategories, Settings.AnimeCategories,
"tvsearch", "tvsearch",