Avoid invalid requests for Nebulance

pull/2171/head
Bogdan 6 months ago
parent d69bf6360a
commit a4546c77ce

@ -114,7 +114,7 @@ namespace NzbDrone.Core.IndexerSearch.Definitions
string episodeString;
if (DateTime.TryParseExact($"{Season} {Episode}", "yyyy MM/dd", CultureInfo.InvariantCulture, DateTimeStyles.None, out var showDate))
{
episodeString = showDate.ToString("yyyy.MM.dd");
episodeString = showDate.ToString("yyyy.MM.dd", CultureInfo.InvariantCulture);
}
else if (Episode.IsNullOrWhiteSpace())
{

@ -74,7 +74,7 @@ namespace NzbDrone.Core.Indexers.BroadcastheNet
else if (DateTime.TryParseExact($"{searchCriteria.Season} {searchCriteria.Episode}", "yyyy MM/dd", CultureInfo.InvariantCulture, DateTimeStyles.None, out var showDate))
{
// Daily Episode
parameters.Name = showDate.ToString("yyyy.MM.dd");
parameters.Name = showDate.ToString("yyyy.MM.dd", CultureInfo.InvariantCulture);
parameters.Category = "Episode";
pageableRequests.Add(GetPagedRequests(parameters, btnResults, btnOffset));
}

@ -66,7 +66,7 @@ namespace NzbDrone.Core.Indexers.Definitions.HDBits
if (DateTime.TryParseExact($"{searchCriteria.Season} {searchCriteria.Episode}", "yyyy MM/dd", CultureInfo.InvariantCulture, DateTimeStyles.None, out var showDate))
{
query.Search = showDate.ToString("yyyy-MM-dd");
query.Search = showDate.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture);
}
else
{

@ -41,7 +41,7 @@ namespace NzbDrone.Core.Indexers.Definitions
public override IIndexerRequestGenerator GetRequestGenerator()
{
return new NebulanceRequestGenerator(Settings);
return new NebulanceRequestGenerator(Settings, _logger);
}
public override IParseIndexerResponse GetParser()
@ -90,10 +90,12 @@ namespace NzbDrone.Core.Indexers.Definitions
public class NebulanceRequestGenerator : IIndexerRequestGenerator
{
private readonly NebulanceSettings _settings;
private readonly Logger _logger;
public NebulanceRequestGenerator(NebulanceSettings settings)
public NebulanceRequestGenerator(NebulanceSettings settings, Logger logger)
{
_settings = settings;
_logger = logger;
}
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
@ -149,6 +151,17 @@ namespace NzbDrone.Core.Indexers.Definitions
}
}
if ((queryParams.Season.HasValue || queryParams.Episode.HasValue) &&
queryParams.Name.IsNullOrWhiteSpace() &&
queryParams.Release.IsNullOrWhiteSpace() &&
!queryParams.TvMaze.HasValue &&
queryParams.Imdb.IsNullOrWhiteSpace())
{
_logger.Debug("NBL API does not support season calls without name, series, id, imdb, tvmaze, or time keys.");
return new IndexerPageableRequestChain();
}
pageableRequests.Add(GetPagedRequests(queryParams, searchCriteria.Limit, searchCriteria.Offset));
return pageableRequests;

Loading…
Cancel
Save