Fixed: Queue not showing items with conflicting titles

pull/8422/head
Qstick 2 years ago
parent 5d061a8729
commit ba7551ec65

@ -112,24 +112,26 @@ namespace NzbDrone.Core.Download.TrackedDownloads
private TrackedDownload ProcessClientItem(IDownloadClient downloadClient, DownloadClientItem downloadItem) private TrackedDownload ProcessClientItem(IDownloadClient downloadClient, DownloadClientItem downloadItem)
{ {
TrackedDownload trackedDownload = null;
try try
{ {
var trackedDownload = _trackedDownloadService.TrackDownload((DownloadClientDefinition)downloadClient.Definition, downloadItem); trackedDownload =
_trackedDownloadService.TrackDownload((DownloadClientDefinition)downloadClient.Definition,
downloadItem);
if (trackedDownload != null && trackedDownload.State == TrackedDownloadState.Downloading) if (trackedDownload != null && trackedDownload.State == TrackedDownloadState.Downloading)
{ {
_failedDownloadService.Check(trackedDownload); _failedDownloadService.Check(trackedDownload);
_completedDownloadService.Check(trackedDownload); _completedDownloadService.Check(trackedDownload);
} }
return trackedDownload;
} }
catch (Exception e) catch (Exception e)
{ {
_logger.Error(e, "Couldn't process tracked download {0}", downloadItem.Title); _logger.Error(e, "Couldn't process tracked download {0}", downloadItem.Title);
} }
return null; return trackedDownload;
} }
private bool DownloadIsTrackable(TrackedDownload trackedDownload) private bool DownloadIsTrackable(TrackedDownload trackedDownload)

@ -10,6 +10,7 @@ using NzbDrone.Core.Download.Aggregation;
using NzbDrone.Core.Download.History; using NzbDrone.Core.Download.History;
using NzbDrone.Core.History; using NzbDrone.Core.History;
using NzbDrone.Core.Messaging.Events; using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.Movies;
using NzbDrone.Core.Movies.Events; using NzbDrone.Core.Movies.Events;
using NzbDrone.Core.Parser; using NzbDrone.Core.Parser;
@ -145,11 +146,12 @@ namespace NzbDrone.Core.Download.TrackedDownloads
trackedDownload.RemoteMovie == null || trackedDownload.RemoteMovie == null ||
trackedDownload.RemoteMovie.Movie == null) trackedDownload.RemoteMovie.Movie == null)
{ {
parsedMovieInfo = _parsingService.ParseMovieInfo(firstHistoryItem.SourceTitle, new List<object> { grabbedHistoryItem }); parsedMovieInfo = Parser.Parser.ParseMovieTitle(firstHistoryItem.SourceTitle);
if (parsedMovieInfo != null) if (parsedMovieInfo != null)
{ {
trackedDownload.RemoteMovie = _parsingService.Map(parsedMovieInfo, "", null); trackedDownload.RemoteMovie = _parsingService.Map(parsedMovieInfo,
firstHistoryItem.MovieId);
} }
} }
} }
@ -166,6 +168,12 @@ namespace NzbDrone.Core.Download.TrackedDownloads
_logger.Trace("No Movie found for download '{0}'", trackedDownload.DownloadItem.Title); _logger.Trace("No Movie found for download '{0}'", trackedDownload.DownloadItem.Title);
} }
} }
catch (MultipleMoviesFoundException e)
{
_logger.Debug(e, "Found multiple movies for " + downloadItem.Title);
trackedDownload.Warn("Unable to import automatically, found multiple movies: {0}", string.Join(", ", e.Movies));
}
catch (Exception e) catch (Exception e)
{ {
_logger.Debug(e, "Failed to find movie for " + downloadItem.Title); _logger.Debug(e, "Failed to find movie for " + downloadItem.Title);

@ -255,6 +255,7 @@ namespace NzbDrone.Core.MediaFiles.MovieImport.Manual
Path = file, Path = file,
RelativePath = rootFolder.GetRelativePath(file), RelativePath = rootFolder.GetRelativePath(file),
Name = Path.GetFileNameWithoutExtension(file), Name = Path.GetFileNameWithoutExtension(file),
Size = _diskProvider.GetFileSize(file),
Rejections = new List<Rejection>() Rejections = new List<Rejection>()
}; };
} }

@ -403,7 +403,7 @@ namespace NzbDrone.Core.Movies
return movies.First(); return movies.First();
} }
throw new MultipleMoviesFoundException("Expected one movie, but found {0}. Matching movies: {1}", movies.Count, string.Join(",", movies)); throw new MultipleMoviesFoundException(movies, "Expected one movie, but found {0}. Matching movies: {1}", movies.Count, string.Join(",", movies));
} }
public void Handle(MovieFileAddedEvent message) public void Handle(MovieFileAddedEvent message)

@ -1,12 +1,16 @@
using System.Collections.Generic;
using NzbDrone.Common.Exceptions; using NzbDrone.Common.Exceptions;
namespace NzbDrone.Core.Movies namespace NzbDrone.Core.Movies
{ {
public class MultipleMoviesFoundException : NzbDroneException public class MultipleMoviesFoundException : NzbDroneException
{ {
public MultipleMoviesFoundException(string message, params object[] args) public List<Movie> Movies { get; set; }
public MultipleMoviesFoundException(List<Movie> movies, string message, params object[] args)
: base(message, args) : base(message, args)
{ {
Movies = movies;
} }
} }
} }

@ -14,6 +14,7 @@ namespace NzbDrone.Core.Parser
{ {
Movie GetMovie(string title); Movie GetMovie(string title);
RemoteMovie Map(ParsedMovieInfo parsedMovieInfo, string imdbId, SearchCriteriaBase searchCriteria = null); RemoteMovie Map(ParsedMovieInfo parsedMovieInfo, string imdbId, SearchCriteriaBase searchCriteria = null);
RemoteMovie Map(ParsedMovieInfo parsedMovieInfo, int movieId);
ParsedMovieInfo ParseMovieInfo(string title, List<object> helpers); ParsedMovieInfo ParseMovieInfo(string title, List<object> helpers);
ParsedMovieInfo ParseMinimalMovieInfo(string path, bool isDir = false); ParsedMovieInfo ParseMinimalMovieInfo(string path, bool isDir = false);
ParsedMovieInfo ParseMinimalPathMovieInfo(string path); ParsedMovieInfo ParseMinimalPathMovieInfo(string path);
@ -98,6 +99,15 @@ namespace NzbDrone.Core.Parser
return Map(parsedMovieInfo, imdbId, null, searchCriteria); return Map(parsedMovieInfo, imdbId, null, searchCriteria);
} }
public RemoteMovie Map(ParsedMovieInfo parsedMovieInfo, int movieId)
{
return new RemoteMovie
{
ParsedMovieInfo = parsedMovieInfo,
Movie = _movieService.GetMovie(movieId)
};
}
public RemoteMovie Map(ParsedMovieInfo parsedMovieInfo, string imdbId, Movie movie, SearchCriteriaBase searchCriteria) public RemoteMovie Map(ParsedMovieInfo parsedMovieInfo, string imdbId, Movie movie, SearchCriteriaBase searchCriteria)
{ {
var remoteMovie = new RemoteMovie var remoteMovie = new RemoteMovie

Loading…
Cancel
Save