Fixed: Manual import not removing unparseable items from queue

Fixed #4831
This commit is contained in:
Mark McDowall 2022-01-23 15:41:07 -08:00
parent 6debc77408
commit 5a9df521ad
2 changed files with 15 additions and 16 deletions

View File

@ -19,7 +19,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Aggregation.Aggregators
var series = localEpisode.Series; var series = localEpisode.Series;
var scores = new List<int>(); var scores = new List<int>();
if (localEpisode.FileEpisodeInfo != null) if (localEpisode.FileEpisodeInfo?.ReleaseTitle != null)
{ {
scores.Add(_preferredWordService.Calculate(series, localEpisode.FileEpisodeInfo.ReleaseTitle, 0)); scores.Add(_preferredWordService.Calculate(series, localEpisode.FileEpisodeInfo.ReleaseTitle, 0));
} }

View File

@ -144,20 +144,18 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Manual
{ {
var downloadClientItem = GetTrackedDownload(downloadId)?.DownloadItem; var downloadClientItem = GetTrackedDownload(downloadId)?.DownloadItem;
var localEpisode = new LocalEpisode var localEpisode = new LocalEpisode();
{ localEpisode.Series = series;
Series = series, localEpisode.Episodes = _episodeService.GetEpisodes(episodeIds);
Episodes = _episodeService.GetEpisodes(episodeIds), localEpisode.FileEpisodeInfo = Parser.Parser.ParsePath(path);
FileEpisodeInfo = Parser.Parser.ParsePath(path), localEpisode.DownloadClientEpisodeInfo = downloadClientItem == null ? null : Parser.Parser.ParseTitle(downloadClientItem.Title);
DownloadClientEpisodeInfo = downloadClientItem == null ? null : Parser.Parser.ParseTitle(downloadClientItem.Title), localEpisode.Path = path;
Path = path, localEpisode.SceneSource = SceneSource(series, rootFolder);
SceneSource = SceneSource(series, rootFolder), localEpisode.ExistingFile = series.Path.IsParentPath(path);
ExistingFile = series.Path.IsParentPath(path), localEpisode.Size = _diskProvider.GetFileSize(path);
Size = _diskProvider.GetFileSize(path), localEpisode.ReleaseGroup = releaseGroup.IsNullOrWhiteSpace() ? Parser.Parser.ParseReleaseGroup(path) : releaseGroup;
ReleaseGroup = releaseGroup.IsNullOrWhiteSpace() ? Parser.Parser.ParseReleaseGroup(path) : releaseGroup, localEpisode.Language = language == Language.Unknown ? LanguageParser.ParseLanguage(path) : language;
Language = language == Language.Unknown ? LanguageParser.ParseLanguage(path) : language, localEpisode.Quality = quality.Quality == Quality.Unknown ? QualityParser.ParseQuality(path) : quality;
Quality = quality.Quality == Quality.Unknown ? QualityParser.ParseQuality(path) : quality
};
return MapItem(_importDecisionMaker.GetDecision(localEpisode, downloadClientItem), rootFolder, downloadId, null); return MapItem(_importDecisionMaker.GetDecision(localEpisode, downloadClientItem), rootFolder, downloadId, null);
} }
@ -466,6 +464,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Manual
localEpisode.SceneSource = !existingFile; localEpisode.SceneSource = !existingFile;
} }
// Augment episode file so imported files have all additional information an automatic import would
localEpisode = _aggregationService.Augment(localEpisode, trackedDownload?.DownloadItem); localEpisode = _aggregationService.Augment(localEpisode, trackedDownload?.DownloadItem);
// Apply the user-chosen values. // Apply the user-chosen values.
@ -521,7 +520,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Manual
var allEpisodesImported = groupedTrackedDownload.Select(c => c.ImportResult) var allEpisodesImported = groupedTrackedDownload.Select(c => c.ImportResult)
.Where(c => c.Result == ImportResultType.Imported) .Where(c => c.Result == ImportResultType.Imported)
.SelectMany(c => c.ImportDecision.LocalEpisode.Episodes).Count() >= .SelectMany(c => c.ImportDecision.LocalEpisode.Episodes).Count() >=
Math.Max(1, trackedDownload.RemoteEpisode.Episodes.Count); Math.Max(1, trackedDownload.RemoteEpisode?.Episodes?.Count ?? 1);
if (allEpisodesImported) if (allEpisodesImported)
{ {