New: Improved Logging of Search for ID based searches

pull/547/head
bakerboy448 3 years ago
parent e49d03ab7b
commit c21e323992

@ -1,3 +1,4 @@
using System.Text;
using NzbDrone.Common.Extensions;
using NzbDrone.Core.Parser;
@ -23,5 +24,42 @@ namespace NzbDrone.Core.IndexerSearch.Definitions
}
public string FullImdbId => ParseUtil.GetFullImdbId(ImdbId);
public override string SearchQuery
{
get
{
var searchQueryTerm = $"Term: []";
if (SearchTerm.IsNotNullOrWhiteSpace())
{
searchQueryTerm = $"Term: [{SearchTerm}]";
}
if (!ImdbId.IsNotNullOrWhiteSpace() && !TmdbId.HasValue && !TraktId.HasValue)
{
return searchQueryTerm;
}
var builder = new StringBuilder(searchQueryTerm);
builder = builder.Append(" | ID(s):");
if (ImdbId.IsNotNullOrWhiteSpace())
{
builder = builder.Append($" IMDbId:[{ImdbId}]");
}
if (TmdbId.HasValue)
{
builder = builder.Append($" TMDbId:[{TmdbId}]");
}
if (TraktId.HasValue)
{
builder = builder.Append($" TraktId:[{TraktId}]");
}
return builder.ToString().Trim();
}
}
}
}

@ -21,9 +21,17 @@ namespace NzbDrone.Core.IndexerSearch.Definitions
public string Source { get; set; }
public string Host { get; set; }
public virtual string SearchQuery
{
get
{
return $"Term: [{SearchTerm}]";
}
}
public override string ToString()
{
return $"{{Term: {SearchTerm}, Offset: {Offset ?? 0}, Limit: {Limit ?? 0}, Categories: [{string.Join(", ", Categories)}]}}";
return $"{SearchQuery}, Offset: {Offset ?? 0}, Limit: {Limit ?? 0}, Categories: [{string.Join(", ", Categories)}]";
}
public virtual bool RssSearch

@ -1,5 +1,6 @@
using System;
using System.Globalization;
using System.Text;
using NzbDrone.Common.Extensions;
using NzbDrone.Core.Parser;
@ -34,6 +35,50 @@ namespace NzbDrone.Core.IndexerSearch.Definitions
}
}
public override string SearchQuery
{
get
{
var searchQueryTerm = $"Term: []";
var searchEpisodeTerm = $" for Season / Episode:[{EpisodeSearchString}]";
if (SearchTerm.IsNotNullOrWhiteSpace())
{
searchQueryTerm = $"Term: [{SearchTerm}]";
}
if (!ImdbId.IsNotNullOrWhiteSpace() && !TvdbId.HasValue && !RId.HasValue && !TraktId.HasValue)
{
return $"{searchQueryTerm}{searchEpisodeTerm}";
}
var builder = new StringBuilder(searchQueryTerm);
builder = builder.Append(" | ID(s):");
if (ImdbId.IsNotNullOrWhiteSpace())
{
builder.Append($" IMDbId:[{ImdbId}]");
}
if (TvdbId.HasValue)
{
builder.Append($" TVDbId:[{TvdbId}]");
}
if (RId.HasValue)
{
builder.Append($" TVRageId:[{RId}]");
}
if (TraktId.HasValue)
{
builder.Append($" TraktId:[{TraktId}]");
}
builder = builder.Append(searchEpisodeTerm);
return builder.ToString().Trim();
}
}
private string GetEpisodeSearchString()
{
if (Season == null || Season == 0)

@ -147,7 +147,7 @@ namespace NzbDrone.Core.IndexerSearch
.ToList();
}
_logger.ProgressInfo("Searching indexers: [{0}] for {1}", string.Join(", ", indexers.Select(i => i.Definition.Name).ToList()), criteriaBase.ToString());
_logger.ProgressInfo("Searching indexer(s): [{0}] for {1}", string.Join(", ", indexers.Select(i => i.Definition.Name).ToList()), criteriaBase.ToString());
var tasks = indexers.Select(x => DispatchIndexer(searchAction, x, criteriaBase));
@ -155,7 +155,7 @@ namespace NzbDrone.Core.IndexerSearch
var reports = batch.SelectMany(x => x).ToList();
_logger.Debug("Total of {0} reports were found for {1} from {2} indexers", reports.Count, criteriaBase, indexers.Count);
_logger.Debug("Total of {0} reports were found for {1} from {2} indexer(s)", reports.Count, criteriaBase, indexers.Count);
return reports;
}

Loading…
Cancel
Save