mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2026-04-20 22:14:34 -04:00
Fixed: (Search) Ensure TvMazeId is parsed correctly on a repeat search
This commit is contained in:
@@ -45,14 +45,20 @@ namespace NzbDrone.Core.IndexerSearch.Definitions
|
||||
{
|
||||
get
|
||||
{
|
||||
var searchQueryTerm = $"Term: []";
|
||||
var searchQueryTerm = "Term: []";
|
||||
var searchEpisodeTerm = $" for Season / Episode:[{EpisodeSearchString}]";
|
||||
if (SearchTerm.IsNotNullOrWhiteSpace())
|
||||
{
|
||||
searchQueryTerm = $"Term: [{SearchTerm}]";
|
||||
}
|
||||
|
||||
if (!ImdbId.IsNotNullOrWhiteSpace() && !TvdbId.HasValue && !RId.HasValue && !TraktId.HasValue)
|
||||
if (!ImdbId.IsNotNullOrWhiteSpace() &&
|
||||
!TvdbId.HasValue &&
|
||||
!RId.HasValue &&
|
||||
!TraktId.HasValue &&
|
||||
!TvMazeId.HasValue &&
|
||||
!TmdbId.HasValue &&
|
||||
!DoubanId.HasValue)
|
||||
{
|
||||
return $"{searchQueryTerm}{searchEpisodeTerm}";
|
||||
}
|
||||
@@ -80,11 +86,21 @@ namespace NzbDrone.Core.IndexerSearch.Definitions
|
||||
builder.Append($" TraktId:[{TraktId}]");
|
||||
}
|
||||
|
||||
if (TvMazeId.HasValue)
|
||||
{
|
||||
builder.Append($" TvMazeId:[{TvMazeId}]");
|
||||
}
|
||||
|
||||
if (TmdbId.HasValue)
|
||||
{
|
||||
builder.Append($" TmdbId:[{TmdbId}]");
|
||||
}
|
||||
|
||||
if (DoubanId.HasValue)
|
||||
{
|
||||
builder.Append($" DoubanId:[{DoubanId}]");
|
||||
}
|
||||
|
||||
builder = builder.Append(searchEpisodeTerm);
|
||||
return builder.ToString().Trim();
|
||||
}
|
||||
@@ -92,29 +108,29 @@ namespace NzbDrone.Core.IndexerSearch.Definitions
|
||||
|
||||
private string GetEpisodeSearchString()
|
||||
{
|
||||
if (Season == null || Season == 0)
|
||||
if (Season is null or 0)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
string episodeString;
|
||||
if (DateTime.TryParseExact(string.Format("{0} {1}", Season, Episode), "yyyy MM/dd", CultureInfo.InvariantCulture, DateTimeStyles.None, out var showDate))
|
||||
if (DateTime.TryParseExact($"{Season} {Episode}", "yyyy MM/dd", CultureInfo.InvariantCulture, DateTimeStyles.None, out var showDate))
|
||||
{
|
||||
episodeString = showDate.ToString("yyyy.MM.dd");
|
||||
}
|
||||
else if (Episode.IsNullOrWhiteSpace())
|
||||
{
|
||||
episodeString = string.Format("S{0:00}", Season);
|
||||
episodeString = $"S{Season:00}";
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
episodeString = string.Format("S{0:00}E{1:00}", Season, ParseUtil.CoerceInt(Episode));
|
||||
episodeString = $"S{Season:00}E{ParseUtil.CoerceInt(Episode):00}";
|
||||
}
|
||||
catch (FormatException)
|
||||
{
|
||||
episodeString = string.Format("S{0:00}E{1}", Season, Episode);
|
||||
episodeString = $"S{Season:00}E{Episode}";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user