From 0cb15121e5f473057ac7e8a3203cee2c3a7e1592 Mon Sep 17 00:00:00 2001 From: Devin Buhl Date: Tue, 7 Feb 2017 03:03:15 -0500 Subject: [PATCH] Fix movies not showing up in Queue when downloading (#640) --- .../TrackedDownloadService.cs | 23 ++++++------------- src/NzbDrone.Core/Parser/ParsingService.cs | 10 +++++--- 2 files changed, 14 insertions(+), 19 deletions(-) diff --git a/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownloadService.cs b/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownloadService.cs index 01f87f07a..575c3bfbc 100644 --- a/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownloadService.cs +++ b/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownloadService.cs @@ -56,7 +56,6 @@ namespace NzbDrone.Core.Download.TrackedDownloads try { - var parsedEpisodeInfo = Parser.Parser.ParseTitle(trackedDownload.DownloadItem.Title); var parsedMovieInfo = Parser.Parser.ParseMovieTitle(trackedDownload.DownloadItem.Title); var historyItems = _historyService.FindByDownloadId(downloadItem.DownloadId); @@ -65,33 +64,25 @@ namespace NzbDrone.Core.Download.TrackedDownloads trackedDownload.RemoteMovie = _parsingService.Map(parsedMovieInfo, "", null); } - if (parsedEpisodeInfo != null) - { - trackedDownload.RemoteEpisode = _parsingService.Map(parsedEpisodeInfo, 0, 0); - } - if (historyItems.Any()) { var firstHistoryItem = historyItems.OrderByDescending(h => h.Date).First(); trackedDownload.State = GetStateFromHistory(firstHistoryItem.EventType); - if ((parsedEpisodeInfo == null || - trackedDownload.RemoteEpisode == null || - trackedDownload.RemoteEpisode.Series == null || - trackedDownload.RemoteEpisode.Episodes.Empty()) && trackedDownload.RemoteMovie == null) + if (parsedMovieInfo == null || + trackedDownload.RemoteMovie == null || + trackedDownload.RemoteMovie.Movie == null) { - // Try parsing the original source title and if that fails, try parsing it as a special - // TODO: Pass the TVDB ID and TVRage IDs in as well so we have a better chance for finding the item - parsedEpisodeInfo = Parser.Parser.ParseTitle(firstHistoryItem.SourceTitle) ?? _parsingService.ParseSpecialEpisodeTitle(firstHistoryItem.SourceTitle, 0, 0); + parsedMovieInfo = Parser.Parser.ParseMovieTitle(firstHistoryItem.SourceTitle); - if (parsedEpisodeInfo != null) + if (parsedMovieInfo != null) { - trackedDownload.RemoteEpisode = _parsingService.Map(parsedEpisodeInfo, firstHistoryItem.SeriesId, historyItems.Where(v => v.EventType == HistoryEventType.Grabbed).Select(h => h.EpisodeId).Distinct()); + trackedDownload.RemoteMovie = _parsingService.Map(parsedMovieInfo, "", null); } } } - if (trackedDownload.RemoteEpisode == null && trackedDownload.RemoteMovie == null) + if (trackedDownload.RemoteMovie == null) { return null; } diff --git a/src/NzbDrone.Core/Parser/ParsingService.cs b/src/NzbDrone.Core/Parser/ParsingService.cs index 2de0d0648..d7fbd8531 100644 --- a/src/NzbDrone.Core/Parser/ParsingService.cs +++ b/src/NzbDrone.Core/Parser/ParsingService.cs @@ -399,11 +399,16 @@ namespace NzbDrone.Core.Parser if (parsedEpisodeInfo.Year > 1900) { movie = _movieService.FindByTitle(parsedEpisodeInfo.MovieTitle, parsedEpisodeInfo.Year); - //Todo: same as above! + } else { - movie = _movieService.FindByTitle(parsedEpisodeInfo.MovieTitle); //Todo: same as above! + movie = _movieService.FindByTitle(parsedEpisodeInfo.MovieTitle); + } + + if (movie == null) + { + movie = _movieService.FindByTitle(parsedEpisodeInfo.MovieTitle); } return movie; } @@ -412,7 +417,6 @@ namespace NzbDrone.Core.Parser if (movie == null && imdbId.IsNotNullOrWhiteSpace()) { - //TODO: If series is found by TvdbId, we should report it as a scene naming exception, since it will fail to import movie = _movieService.FindByImdbId(imdbId); }