From b0f755a30ceade3ee74532d6b8c3a4979b631747 Mon Sep 17 00:00:00 2001 From: Bogdan Date: Mon, 22 Jul 2024 00:35:03 +0300 Subject: [PATCH] Fixed: (Nebulance) Searching for daily episodes using ids --- .../Indexers/Definitions/Nebulance.cs | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/NzbDrone.Core/Indexers/Definitions/Nebulance.cs b/src/NzbDrone.Core/Indexers/Definitions/Nebulance.cs index facdebd2a..2c3f74e50 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Nebulance.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Nebulance.cs @@ -133,9 +133,15 @@ namespace NzbDrone.Core.Indexers.Definitions queryParams.Release = searchQuery; } - if (DateTime.TryParseExact($"{searchCriteria.Season} {searchCriteria.Episode}", "yyyy MM/dd", CultureInfo.InvariantCulture, DateTimeStyles.None, out var showDate)) + if (searchCriteria.Season.HasValue && + searchCriteria.Episode.IsNotNullOrWhiteSpace() && + DateTime.TryParseExact($"{searchCriteria.Season} {searchCriteria.Episode}", "yyyy MM/dd", CultureInfo.InvariantCulture, DateTimeStyles.None, out var showDate)) { - queryParams.Name = searchQuery; + if (searchQuery.IsNotNullOrWhiteSpace()) + { + queryParams.Name = searchQuery; + } + queryParams.Release = showDate.ToString("yyyy.MM.dd", CultureInfo.InvariantCulture); } else @@ -162,7 +168,7 @@ namespace NzbDrone.Core.Indexers.Definitions return new IndexerPageableRequestChain(); } - if (queryParams.Name is { Length: < 3 } || queryParams.Release is { Length: < 3 }) + if (queryParams.Name is { Length: > 0 and < 3 } || queryParams.Release is { Length: > 0 and < 3 }) { _logger.Debug("NBL API does not support release calls that are 2 characters or fewer."); @@ -195,6 +201,13 @@ namespace NzbDrone.Core.Indexers.Definitions queryParams.Release = searchQuery; } + if (queryParams.Release is { Length: > 0 and < 3 }) + { + _logger.Debug("NBL API does not support release calls that are 2 characters or fewer."); + + return new IndexerPageableRequestChain(); + } + pageableRequests.Add(GetPagedRequests(queryParams, searchCriteria.Limit, searchCriteria.Offset)); return pageableRequests;