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

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