Updated Newznab to correctly identify movie search capabilities

pull/34/head
Leonardo Galli 8 years ago
parent 82470bd995
commit 70c8228605

@ -30,6 +30,7 @@ namespace NzbDrone.Core.Indexers.Newznab
public NewznabCapabilities GetCapabilities(NewznabSettings indexerSettings)
{
var key = indexerSettings.ToJson();
_capabilitiesCache.Clear();
var capabilities = _capabilitiesCache.Get(key, () => FetchCapabilities(indexerSettings), TimeSpan.FromDays(7));
return capabilities;
@ -98,6 +99,16 @@ namespace NzbDrone.Core.Indexers.Newznab
capabilities.SupportedTvSearchParameters = xmlTvSearch.Attribute("supportedParams").Value.Split(',');
capabilities.SupportsAggregateIdSearch = true;
}
var xmlMovieSearch = xmlSearching.Element("movie-search");
if (xmlMovieSearch == null || xmlMovieSearch.Attribute("available").Value != "yes")
{
capabilities.SupportedMovieSearchParamters = null;
}
else if (xmlMovieSearch.Attribute("supportedParams") != null)
{
capabilities.SupportedMovieSearchParamters = xmlMovieSearch.Attribute("supportedParams").Value.Split(',');
capabilities.SupportsAggregateIdSearch = true;
}
}
var xmlCategories = xmlRoot.Element("categories");

@ -92,9 +92,7 @@ namespace NzbDrone.Core.Indexers.Newznab
var capabilities = _capabilitiesProvider.GetCapabilities(Settings);
return capabilities.SupportedMovieSearchParamters != null &&
capabilities.SupportedMovieSearchParamters.Contains("imdb") &&
capabilities.SupportedMovieSearchParamters.Contains("imdbtitle") &&
capabilities.SupportedMovieSearchParamters.Contains("imdbyear");
capabilities.SupportedMovieSearchParamters.Contains("imdb");
}
}
@ -131,6 +129,12 @@ namespace NzbDrone.Core.Indexers.Newznab
pageableRequests.Add(GetPagedRequests(MaxPages, Settings.Categories, "movie",
string.Format("&imdbid={0}", searchCriteria.Movie.ImdbId.Substring(2)))); //strip off the "tt" - VERY HACKY
}
else
{
//Let's try anyways with q parameter, worst case nothing found.
pageableRequests.Add(GetPagedRequests(MaxPages, Settings.Categories, "search",
string.Format("&q={0}", searchCriteria.Movie.Title)));
}
return pageableRequests;
}

Loading…
Cancel
Save