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

This commit is contained in:
Devin Buhl 2017-02-07 03:03:15 -05:00 committed by GitHub
parent 808033a01c
commit 0cb15121e5
2 changed files with 14 additions and 19 deletions

View File

@ -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;
}

View File

@ -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);
}