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