From 7a269efcbc24b89a1ebeb7a9f9a2a75ddb829c9e Mon Sep 17 00:00:00 2001 From: Devin Buhl Date: Mon, 27 Feb 2017 20:16:54 -0500 Subject: [PATCH] Fixed problem with TMDb list when Year is null, Revert using UrlPathEncode on newznab requests (#937) * Fixed problem with TMDb list when Year is null * Fuck it, just skip movies with no year. Once they have a year they will be automagically added if sync is enabled. * Revert using UrlPathEncode on newznab requests --- .../Newznab/NewznabRequestGenerator.cs | 53 +++++++++---------- .../CouchPotato/CouchPotatoImport.cs | 18 ------- .../CouchPotato/CouchPotatoParser.cs | 2 - .../CouchPotato/CouchPotatoSettings.cs | 3 +- .../NetImport/TMDb/TMDbParser.cs | 12 +++++ 5 files changed, 38 insertions(+), 50 deletions(-) diff --git a/src/NzbDrone.Core/Indexers/Newznab/NewznabRequestGenerator.cs b/src/NzbDrone.Core/Indexers/Newznab/NewznabRequestGenerator.cs index db6acc744..8a25f064c 100644 --- a/src/NzbDrone.Core/Indexers/Newznab/NewznabRequestGenerator.cs +++ b/src/NzbDrone.Core/Indexers/Newznab/NewznabRequestGenerator.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Net; using NzbDrone.Common.Extensions; using NzbDrone.Common.Http; using NzbDrone.Core.IndexerSearch.Definitions; @@ -57,37 +58,12 @@ namespace NzbDrone.Core.Indexers.Newznab } else { - pageableRequests.Add(GetPagedRequests(MaxPages, Settings.Categories, "search", $"&q={System.Web.HttpUtility.UrlPathEncode(Parser.Parser.NormalizeTitle(searchCriteria.Movie.Title))}%20{searchCriteria.Movie.Year}")); + pageableRequests.Add(GetPagedRequests(MaxPages, Settings.Categories, "search", $"&q={Parser.Parser.NormalizeTitle(searchCriteria.Movie.Title)}%20{searchCriteria.Movie.Year}")); } return pageableRequests; } - public virtual IndexerPageableRequestChain GetSearchRequests(SingleEpisodeSearchCriteria searchCriteria) - { - return new IndexerPageableRequestChain(); - } - - public virtual IndexerPageableRequestChain GetSearchRequests(SeasonSearchCriteria searchCriteria) - { - return new IndexerPageableRequestChain(); - } - - public virtual IndexerPageableRequestChain GetSearchRequests(DailyEpisodeSearchCriteria searchCriteria) - { - return new IndexerPageableRequestChain(); - } - - public virtual IndexerPageableRequestChain GetSearchRequests(AnimeEpisodeSearchCriteria searchCriteria) - { - return new IndexerPageableRequestChain(); - } - - public virtual IndexerPageableRequestChain GetSearchRequests(SpecialEpisodeSearchCriteria searchCriteria) - { - return new IndexerPageableRequestChain(); - } - private IEnumerable GetPagedRequests(int maxPages, IEnumerable categories, string searchType, string parameters) { if (categories.Empty()) @@ -117,9 +93,30 @@ namespace NzbDrone.Core.Indexers.Newznab } } - private static string NewsnabifyTitle(string title) + + public virtual IndexerPageableRequestChain GetSearchRequests(SingleEpisodeSearchCriteria searchCriteria) + { + return new IndexerPageableRequestChain(); + } + + public virtual IndexerPageableRequestChain GetSearchRequests(SeasonSearchCriteria searchCriteria) + { + return new IndexerPageableRequestChain(); + } + + public virtual IndexerPageableRequestChain GetSearchRequests(DailyEpisodeSearchCriteria searchCriteria) + { + return new IndexerPageableRequestChain(); + } + + public virtual IndexerPageableRequestChain GetSearchRequests(AnimeEpisodeSearchCriteria searchCriteria) { - return title.Replace("+", "%20"); + return new IndexerPageableRequestChain(); + } + + public virtual IndexerPageableRequestChain GetSearchRequests(SpecialEpisodeSearchCriteria searchCriteria) + { + return new IndexerPageableRequestChain(); } } } diff --git a/src/NzbDrone.Core/NetImport/CouchPotato/CouchPotatoImport.cs b/src/NzbDrone.Core/NetImport/CouchPotato/CouchPotatoImport.cs index 8a79bf05d..5da56d71e 100644 --- a/src/NzbDrone.Core/NetImport/CouchPotato/CouchPotatoImport.cs +++ b/src/NzbDrone.Core/NetImport/CouchPotato/CouchPotatoImport.cs @@ -15,24 +15,6 @@ namespace NzbDrone.Core.NetImport.CouchPotato : base(httpClient, configService, parsingService, logger) { } - /*public new virtual IEnumerable DefaultDefinitions - { - get - { - var config = (CouchPotatoSettings)new CouchPotatoSettings(); - config.Link = "http://localhost"; - config.Port = "5050"; - - yield return new NetImportDefinition - { - Name = "Localhost", - Enabled = config.Validate().IsValid && Enabled, - Implementation = GetType().Name, - Settings = config - }; - } - }*/ - public override INetImportRequestGenerator GetRequestGenerator() { return new CouchPotatoRequestGenerator() { Settings = Settings }; diff --git a/src/NzbDrone.Core/NetImport/CouchPotato/CouchPotatoParser.cs b/src/NzbDrone.Core/NetImport/CouchPotato/CouchPotatoParser.cs index 05a195f1e..94ba0a27f 100644 --- a/src/NzbDrone.Core/NetImport/CouchPotato/CouchPotatoParser.cs +++ b/src/NzbDrone.Core/NetImport/CouchPotato/CouchPotatoParser.cs @@ -15,8 +15,6 @@ namespace NzbDrone.Core.NetImport.CouchPotato private NetImportResponse _importResponse; private readonly Logger _logger; - private static readonly Regex ReplaceEntities = new Regex("&[a-z]+;", RegexOptions.Compiled | RegexOptions.IgnoreCase); - public CouchPotatoParser(CouchPotatoSettings settings) { _settings = settings; diff --git a/src/NzbDrone.Core/NetImport/CouchPotato/CouchPotatoSettings.cs b/src/NzbDrone.Core/NetImport/CouchPotato/CouchPotatoSettings.cs index 5e05621fb..8e9a6eb43 100644 --- a/src/NzbDrone.Core/NetImport/CouchPotato/CouchPotatoSettings.cs +++ b/src/NzbDrone.Core/NetImport/CouchPotato/CouchPotatoSettings.cs @@ -34,8 +34,7 @@ namespace NzbDrone.Core.NetImport.CouchPotato [FieldDefinition(1, Label = "CouchPotato Port", HelpText = "Port your CoouchPootato uses.")] public int Port { get; set; } - [FieldDefinition(2, Label = "CouchPotato Url Base", - HelpText = "UrlBase your CoouchPootato uses, leave blank for none")] + [FieldDefinition(2, Label = "CouchPotato Url Base", HelpText = "UrlBase your CoouchPootato uses, leave blank for none")] public string UrlBase { get; set; } [FieldDefinition(3, Label = "CouchPotato API Key", HelpText = "CoouchPootato API Key.")] diff --git a/src/NzbDrone.Core/NetImport/TMDb/TMDbParser.cs b/src/NzbDrone.Core/NetImport/TMDb/TMDbParser.cs index 1f0589c82..beb8ad013 100644 --- a/src/NzbDrone.Core/NetImport/TMDb/TMDbParser.cs +++ b/src/NzbDrone.Core/NetImport/TMDb/TMDbParser.cs @@ -43,6 +43,12 @@ namespace NzbDrone.Core.NetImport.TMDb foreach (var movie in jsonResponse.results) { + // Movies with no Year Fix + if (string.IsNullOrWhiteSpace(movie.release_date)) + { + continue; + } + movies.AddIfNotNull(new Tv.Movie() { Title = movie.title, @@ -70,6 +76,12 @@ namespace NzbDrone.Core.NetImport.TMDb continue; } + // Movies with no Year Fix + if (string.IsNullOrWhiteSpace(movie.release_date)) + { + continue; + } + movies.AddIfNotNull(new Tv.Movie() { Title = movie.title,