Fixed: Queue not showing items with conflicting titles

This commit is contained in:
Qstick 2023-04-22 23:20:38 -05:00
parent 5d061a8729
commit ba7551ec65
6 changed files with 33 additions and 8 deletions

View File

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

View File

@ -10,6 +10,7 @@ using NzbDrone.Core.Download.Aggregation;
using NzbDrone.Core.Download.History;
using NzbDrone.Core.History;
using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.Movies;
using NzbDrone.Core.Movies.Events;
using NzbDrone.Core.Parser;
@ -145,11 +146,12 @@ namespace NzbDrone.Core.Download.TrackedDownloads
trackedDownload.RemoteMovie == null ||
trackedDownload.RemoteMovie.Movie == null)
{
parsedMovieInfo = _parsingService.ParseMovieInfo(firstHistoryItem.SourceTitle, new List<object> { grabbedHistoryItem });
parsedMovieInfo = Parser.Parser.ParseMovieTitle(firstHistoryItem.SourceTitle);
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);
}
}
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)
{
_logger.Debug(e, "Failed to find movie for " + downloadItem.Title);

View File

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

View File

@ -403,7 +403,7 @@ namespace NzbDrone.Core.Movies
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)

View File

@ -1,12 +1,16 @@
using System.Collections.Generic;
using NzbDrone.Common.Exceptions;
namespace NzbDrone.Core.Movies
{
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)
{
Movies = movies;
}
}
}

View File

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