forked from Sonarr/Sonarr
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New: Add option to search for anime using standard episode numbers
Closes Sonarr#4153
- Loading branch information
Showing
12 changed files
with
281 additions
and
26 deletions.
There are no files selected for viewing
85 changes: 85 additions & 0 deletions
85
src/NzbDrone.Core.Test/IndexerTests/FanzubTests/FanzubRequestGeneratorFixture.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using FluentAssertions; | ||
using NUnit.Framework; | ||
using NzbDrone.Core.Indexers.Fanzub; | ||
using NzbDrone.Core.IndexerSearch.Definitions; | ||
using NzbDrone.Core.Test.Framework; | ||
|
||
namespace NzbDrone.Core.Test.IndexerTests.FanzubTests | ||
{ | ||
public class FanzubRequestGeneratorFixture : CoreTest<FanzubRequestGenerator> | ||
{ | ||
private SeasonSearchCriteria _seasonSearchCriteria; | ||
private AnimeEpisodeSearchCriteria _animeSearchCriteria; | ||
|
||
[SetUp] | ||
public void SetUp() | ||
{ | ||
Subject.Settings = new FanzubSettings() | ||
{ | ||
BaseUrl = "http://127.0.0.1:1234/", | ||
}; | ||
|
||
_seasonSearchCriteria = new SeasonSearchCriteria() | ||
{ | ||
SceneTitles = new List<string>() { "Naruto Shippuuden" }, | ||
SeasonNumber = 1, | ||
}; | ||
|
||
_animeSearchCriteria = new AnimeEpisodeSearchCriteria() | ||
{ | ||
SceneTitles = new List<string>() { "Naruto Shippuuden" }, | ||
AbsoluteEpisodeNumber = 9, | ||
SeasonNumber = 1, | ||
EpisodeNumber = 9 | ||
}; | ||
} | ||
|
||
[Test] | ||
public void should_not_search_season() | ||
{ | ||
var results = Subject.GetSearchRequests(_seasonSearchCriteria); | ||
|
||
results.GetAllTiers().Should().HaveCount(0); | ||
} | ||
|
||
[Test] | ||
public void should_search_season() | ||
{ | ||
Subject.Settings.AnimeStandardFormatSearch = true; | ||
var results = Subject.GetSearchRequests(_seasonSearchCriteria); | ||
|
||
results.GetAllTiers().Should().HaveCount(1); | ||
|
||
var page = results.GetAllTiers().First().First(); | ||
|
||
page.Url.FullUri.Should().Contain("q=\"Naruto+Shippuuden%20S01\"|\"Naruto+Shippuuden%20-%20S01\""); | ||
} | ||
|
||
[Test] | ||
public void should_use_only_absolute_numbering_for_anime_search() | ||
{ | ||
var results = Subject.GetSearchRequests(_animeSearchCriteria); | ||
|
||
results.GetAllTiers().Should().HaveCount(1); | ||
|
||
var page = results.GetAllTiers().First().First(); | ||
|
||
page.Url.FullUri.Should().Contain("q=\"Naruto+Shippuuden%2009\"|\"Naruto+Shippuuden%20-%2009\""); | ||
} | ||
|
||
[Test] | ||
public void should_also_use_standard_numbering_for_anime_search() | ||
{ | ||
Subject.Settings.AnimeStandardFormatSearch = true; | ||
var results = Subject.GetSearchRequests(_animeSearchCriteria); | ||
|
||
results.GetAllTiers().Should().HaveCount(1); | ||
|
||
var page = results.GetAllTiers().First().First(); | ||
|
||
page.Url.FullUri.Should().Contain("q=\"Naruto+Shippuuden%2009\"|\"Naruto+Shippuuden%20-%2009\"|\"Naruto+Shippuuden%20S01E09\"|\"Naruto+Shippuuden%20-%20S01E09\""); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 86 additions & 0 deletions
86
src/NzbDrone.Core.Test/IndexerTests/NyaaTests/NyaaRequestGeneratorFixture.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using FluentAssertions; | ||
using NUnit.Framework; | ||
using NzbDrone.Core.Indexers.Nyaa; | ||
using NzbDrone.Core.IndexerSearch.Definitions; | ||
using NzbDrone.Core.Test.Framework; | ||
|
||
namespace NzbDrone.Core.Test.IndexerTests.NyaaTests | ||
{ | ||
public class NyaaRequestGeneratorFixture : CoreTest<NyaaRequestGenerator> | ||
{ | ||
private SeasonSearchCriteria _seasonSearchCriteria; | ||
private AnimeEpisodeSearchCriteria _animeSearchCriteria; | ||
|
||
[SetUp] | ||
public void SetUp() | ||
{ | ||
Subject.Settings = new NyaaSettings() | ||
{ | ||
BaseUrl = "http://127.0.0.1:1234/", | ||
}; | ||
|
||
_seasonSearchCriteria = new SeasonSearchCriteria() | ||
{ | ||
SceneTitles = new List<string>() { "Naruto Shippuuden" }, | ||
SeasonNumber = 1, | ||
}; | ||
|
||
_animeSearchCriteria = new AnimeEpisodeSearchCriteria() | ||
{ | ||
SceneTitles = new List<string>() { "Naruto Shippuuden" }, | ||
AbsoluteEpisodeNumber = 9, | ||
SeasonNumber = 1, | ||
EpisodeNumber = 9 | ||
}; | ||
} | ||
|
||
[Test] | ||
public void should_not_search_season() | ||
{ | ||
var results = Subject.GetSearchRequests(_seasonSearchCriteria); | ||
|
||
results.GetAllTiers().Should().HaveCount(0); | ||
} | ||
|
||
[Test] | ||
public void should_search_season() | ||
{ | ||
Subject.Settings.AnimeStandardFormatSearch = true; | ||
var results = Subject.GetSearchRequests(_seasonSearchCriteria); | ||
|
||
results.GetAllTiers().Should().HaveCount(1); | ||
|
||
var page = results.GetAllTiers().First().First(); | ||
|
||
page.Url.FullUri.Should().Contain("term=Naruto+Shippuuden+s01"); | ||
} | ||
|
||
[Test] | ||
public void should_use_only_absolute_numbering_for_anime_search() | ||
{ | ||
var results = Subject.GetSearchRequests(_animeSearchCriteria); | ||
|
||
results.GetTier(0).Should().HaveCount(2); | ||
var pages = results.GetTier(0).Take(2).Select(t => t.First()).ToList(); | ||
|
||
pages[0].Url.FullUri.Should().Contain("term=Naruto+Shippuuden+9"); | ||
pages[1].Url.FullUri.Should().Contain("term=Naruto+Shippuuden+09"); | ||
} | ||
|
||
[Test] | ||
public void should_also_use_standard_numbering_for_anime_search() | ||
{ | ||
Subject.Settings.AnimeStandardFormatSearch = true; | ||
var results = Subject.GetSearchRequests(_animeSearchCriteria); | ||
|
||
results.GetTier(0).Should().HaveCount(3); | ||
var pages = results.GetTier(0).Take(3).Select(t => t.First()).ToList(); | ||
|
||
pages[0].Url.FullUri.Should().Contain("term=Naruto+Shippuuden+9"); | ||
pages[1].Url.FullUri.Should().Contain("term=Naruto+Shippuuden+09"); | ||
pages[2].Url.FullUri.Should().Contain("term=Naruto+Shippuuden+s01e09"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.