diff --git a/src/NzbDrone.Core/Indexers/Newznab/Newznab.cs b/src/NzbDrone.Core/Indexers/Newznab/Newznab.cs index bd75f0382..7a26587cd 100644 --- a/src/NzbDrone.Core/Indexers/Newznab/Newznab.cs +++ b/src/NzbDrone.Core/Indexers/Newznab/Newznab.cs @@ -106,8 +106,8 @@ namespace NzbDrone.Core.Indexers.Newznab } if (capabilities.SupportedTvSearchParameters != null && - new[] { "q", "tvdbid", "rid" }.Any(v => capabilities.SupportedTvSearchParameters.Contains(v)) && - new[] { "season", "ep" }.All(v => capabilities.SupportedTvSearchParameters.Contains(v))) + new[] { "q", "imdb" }.Any(v => capabilities.SupportedMovieSearchParamters.Contains(v)) && + new[] { "imdbtitle", "imdbyear" }.All(v => capabilities.SupportedMovieSearchParamters.Contains(v))) { return null; } diff --git a/src/NzbDrone.Core/Indexers/Newznab/NewznabCapabilities.cs b/src/NzbDrone.Core/Indexers/Newznab/NewznabCapabilities.cs index 11e73da34..1385eaa1a 100644 --- a/src/NzbDrone.Core/Indexers/Newznab/NewznabCapabilities.cs +++ b/src/NzbDrone.Core/Indexers/Newznab/NewznabCapabilities.cs @@ -8,6 +8,7 @@ namespace NzbDrone.Core.Indexers.Newznab public int MaxPageSize { get; set; } public string[] SupportedSearchParameters { get; set; } public string[] SupportedTvSearchParameters { get; set; } + public string[] SupportedMovieSearchParamters { get; set; } public bool SupportsAggregateIdSearch { get; set; } public List Categories { get; set; } @@ -16,6 +17,7 @@ namespace NzbDrone.Core.Indexers.Newznab DefaultPageSize = 100; MaxPageSize = 100; SupportedSearchParameters = new[] { "q" }; + SupportedMovieSearchParamters = new[] { "q", "imdb", "imdbtitle", "imdbyear" }; SupportedTvSearchParameters = new[] { "q", "rid", "season", "ep" }; // This should remain 'rid' for older newznab installs. SupportsAggregateIdSearch = false; Categories = new List(); diff --git a/src/NzbDrone.Core/Indexers/Newznab/NewznabRequestGenerator.cs b/src/NzbDrone.Core/Indexers/Newznab/NewznabRequestGenerator.cs index 59fec15cc..76030a2ec 100644 --- a/src/NzbDrone.Core/Indexers/Newznab/NewznabRequestGenerator.cs +++ b/src/NzbDrone.Core/Indexers/Newznab/NewznabRequestGenerator.cs @@ -85,6 +85,19 @@ namespace NzbDrone.Core.Indexers.Newznab } } + private bool SupportsMovieSearch + { + get + { + var capabilities = _capabilitiesProvider.GetCapabilities(Settings); + + return capabilities.SupportedMovieSearchParamters != null && + capabilities.SupportedMovieSearchParamters.Contains("imdb") && + capabilities.SupportedMovieSearchParamters.Contains("imdbtitle") && + capabilities.SupportedMovieSearchParamters.Contains("imdbyear"); + } + } + private bool SupportsAggregatedIdSearch { get @@ -109,6 +122,19 @@ namespace NzbDrone.Core.Indexers.Newznab return pageableRequests; } + public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria) + { + var pageableRequests = new IndexerPageableRequestChain(); + + if(SupportsMovieSearch) + { + pageableRequests.Add(GetPagedRequests(MaxPages, Settings.Categories, "movie", + string.Format("&imdbid={0}", searchCriteria.Movie.ImdbId.Substring(2)))); //strip off the "tt" - VERY HACKY + } + + return pageableRequests; + } + public virtual IndexerPageableRequestChain GetSearchRequests(SingleEpisodeSearchCriteria searchCriteria) { var pageableRequests = new IndexerPageableRequestChain(); @@ -274,10 +300,5 @@ namespace NzbDrone.Core.Indexers.Newznab { return title.Replace("+", "%20"); } - - public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria) - { - return new IndexerPageableRequestChain(); - } } }