Updated Newznab to correctly identify movie search capabilities

This commit is contained in:
Leonardo Galli 2017-01-05 13:16:23 +01:00
parent 82470bd995
commit 70c8228605
2 changed files with 18 additions and 3 deletions

View File

@ -30,6 +30,7 @@ namespace NzbDrone.Core.Indexers.Newznab
public NewznabCapabilities GetCapabilities(NewznabSettings indexerSettings) public NewznabCapabilities GetCapabilities(NewznabSettings indexerSettings)
{ {
var key = indexerSettings.ToJson(); var key = indexerSettings.ToJson();
_capabilitiesCache.Clear();
var capabilities = _capabilitiesCache.Get(key, () => FetchCapabilities(indexerSettings), TimeSpan.FromDays(7)); var capabilities = _capabilitiesCache.Get(key, () => FetchCapabilities(indexerSettings), TimeSpan.FromDays(7));
return capabilities; return capabilities;
@ -98,6 +99,16 @@ namespace NzbDrone.Core.Indexers.Newznab
capabilities.SupportedTvSearchParameters = xmlTvSearch.Attribute("supportedParams").Value.Split(','); capabilities.SupportedTvSearchParameters = xmlTvSearch.Attribute("supportedParams").Value.Split(',');
capabilities.SupportsAggregateIdSearch = true; 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"); var xmlCategories = xmlRoot.Element("categories");

View File

@ -92,9 +92,7 @@ namespace NzbDrone.Core.Indexers.Newznab
var capabilities = _capabilitiesProvider.GetCapabilities(Settings); var capabilities = _capabilitiesProvider.GetCapabilities(Settings);
return capabilities.SupportedMovieSearchParamters != null && return capabilities.SupportedMovieSearchParamters != null &&
capabilities.SupportedMovieSearchParamters.Contains("imdb") && capabilities.SupportedMovieSearchParamters.Contains("imdb");
capabilities.SupportedMovieSearchParamters.Contains("imdbtitle") &&
capabilities.SupportedMovieSearchParamters.Contains("imdbyear");
} }
} }
@ -131,6 +129,12 @@ namespace NzbDrone.Core.Indexers.Newznab
pageableRequests.Add(GetPagedRequests(MaxPages, Settings.Categories, "movie", pageableRequests.Add(GetPagedRequests(MaxPages, Settings.Categories, "movie",
string.Format("&imdbid={0}", searchCriteria.Movie.ImdbId.Substring(2)))); //strip off the "tt" - VERY HACKY 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; return pageableRequests;
} }