mirror of
https://github.com/Sonarr/Sonarr.git
synced 2025-01-10 23:29:53 +02:00
Fixed: Fixed issue where NzbMatrix servers would die if series title started with 'the'
This commit is contained in:
parent
24dae1927f
commit
2303a02a06
@ -237,15 +237,16 @@ public void newzbin_search_returns_valid_results(string title, int season, int e
|
||||
result.Should().NotBeEmpty();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void nzbmatrix_search_returns_valid_results()
|
||||
[TestCase("simpsons", 21, 23)]
|
||||
[TestCase("The walking dead", 2, 10)]
|
||||
public void nzbmatrix_search_returns_valid_results(string title, int season, int episode)
|
||||
{
|
||||
WithConfiguredIndexers();
|
||||
|
||||
|
||||
Mocker.Resolve<HttpProvider>();
|
||||
|
||||
var result = Mocker.Resolve<NzbMatrix>().FetchEpisode("Simpsons", 21, 23);
|
||||
var result = Mocker.Resolve<NzbMatrix>().FetchEpisode(title, season, episode);
|
||||
|
||||
Mark500Inconclusive();
|
||||
|
||||
@ -253,6 +254,7 @@ public void nzbmatrix_search_returns_valid_results()
|
||||
}
|
||||
|
||||
|
||||
|
||||
[Test]
|
||||
public void nzbmatrix_multi_word_search_returns_valid_results()
|
||||
{
|
||||
@ -275,7 +277,7 @@ public void nzbmatrix_multi_word_search_returns_valid_results()
|
||||
public void get_query_title(string raw, string clean)
|
||||
{
|
||||
var mock = new Mock<IndexerBase>();
|
||||
mock.CallBase = true;
|
||||
mock.CallBase = true;
|
||||
var result = mock.Object.GetQueryTitle(raw);
|
||||
result.Should().Be(clean);
|
||||
}
|
||||
@ -387,7 +389,7 @@ public void none_503_server_error_should_still_log_error()
|
||||
public void indexer_that_isnt_configured_shouldnt_make_an_http_call()
|
||||
{
|
||||
Mocker.Resolve<NotConfiguredIndexer>().FetchRss();
|
||||
|
||||
|
||||
Mocker.GetMock<HttpProvider>()
|
||||
.Verify(c => c.DownloadFile(It.IsAny<string>(), It.IsAny<string>()), Times.Never());
|
||||
|
||||
|
@ -19,6 +19,7 @@ public abstract class IndexerBase
|
||||
protected readonly ConfigProvider _configProvider;
|
||||
|
||||
private static readonly Regex TitleSearchRegex = new Regex(@"[\W]", RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
||||
protected static readonly Regex RemoveThe = new Regex(@"^the\s", RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
||||
|
||||
[Inject]
|
||||
protected IndexerBase(HttpProvider httpProvider, ConfigProvider configProvider)
|
||||
@ -230,6 +231,8 @@ public EpisodeParseResult ParseFeed(SyndicationItem item)
|
||||
/// <returns></returns>
|
||||
public virtual string GetQueryTitle(string title)
|
||||
{
|
||||
title = RemoveThe.Replace(title, string.Empty);
|
||||
|
||||
var cleanTitle = TitleSearchRegex.Replace(title, "+").Trim('+', ' ');
|
||||
|
||||
//remove any repeating +s
|
||||
|
@ -116,6 +116,7 @@ public override string GetQueryTitle(string title)
|
||||
{
|
||||
//Replace apostrophe with empty string
|
||||
title = title.Replace("'", "");
|
||||
title = RemoveThe.Replace(title, string.Empty);
|
||||
var cleanTitle = TitleSearchRegex.Replace(title, "+").Trim('+', ' ');
|
||||
|
||||
//remove any repeating +s
|
||||
|
Loading…
Reference in New Issue
Block a user