Fix movies not showing up in Queue when downloading (#640)

pull/2/head
Devin Buhl 8 years ago committed by GitHub
parent 808033a01c
commit 0cb15121e5

@ -56,7 +56,6 @@ namespace NzbDrone.Core.Download.TrackedDownloads
try try
{ {
var parsedEpisodeInfo = Parser.Parser.ParseTitle(trackedDownload.DownloadItem.Title);
var parsedMovieInfo = Parser.Parser.ParseMovieTitle(trackedDownload.DownloadItem.Title); var parsedMovieInfo = Parser.Parser.ParseMovieTitle(trackedDownload.DownloadItem.Title);
var historyItems = _historyService.FindByDownloadId(downloadItem.DownloadId); var historyItems = _historyService.FindByDownloadId(downloadItem.DownloadId);
@ -65,33 +64,25 @@ namespace NzbDrone.Core.Download.TrackedDownloads
trackedDownload.RemoteMovie = _parsingService.Map(parsedMovieInfo, "", null); trackedDownload.RemoteMovie = _parsingService.Map(parsedMovieInfo, "", null);
} }
if (parsedEpisodeInfo != null)
{
trackedDownload.RemoteEpisode = _parsingService.Map(parsedEpisodeInfo, 0, 0);
}
if (historyItems.Any()) if (historyItems.Any())
{ {
var firstHistoryItem = historyItems.OrderByDescending(h => h.Date).First(); var firstHistoryItem = historyItems.OrderByDescending(h => h.Date).First();
trackedDownload.State = GetStateFromHistory(firstHistoryItem.EventType); trackedDownload.State = GetStateFromHistory(firstHistoryItem.EventType);
if ((parsedEpisodeInfo == null || if (parsedMovieInfo == null ||
trackedDownload.RemoteEpisode == null || trackedDownload.RemoteMovie == null ||
trackedDownload.RemoteEpisode.Series == null || trackedDownload.RemoteMovie.Movie == null)
trackedDownload.RemoteEpisode.Episodes.Empty()) && trackedDownload.RemoteMovie == null)
{ {
// Try parsing the original source title and if that fails, try parsing it as a special parsedMovieInfo = Parser.Parser.ParseMovieTitle(firstHistoryItem.SourceTitle);
// 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);
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; return null;
} }

@ -399,11 +399,16 @@ namespace NzbDrone.Core.Parser
if (parsedEpisodeInfo.Year > 1900) if (parsedEpisodeInfo.Year > 1900)
{ {
movie = _movieService.FindByTitle(parsedEpisodeInfo.MovieTitle, parsedEpisodeInfo.Year); movie = _movieService.FindByTitle(parsedEpisodeInfo.MovieTitle, parsedEpisodeInfo.Year);
//Todo: same as above!
} }
else 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; return movie;
} }
@ -412,7 +417,6 @@ namespace NzbDrone.Core.Parser
if (movie == null && imdbId.IsNotNullOrWhiteSpace()) 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); movie = _movieService.FindByImdbId(imdbId);
} }

Loading…
Cancel
Save