Fixed: Manual Import failing to show files when processing fails

pull/3396/head
Mark McDowall 5 years ago
parent 84e6674e23
commit d402f7514e

@ -158,7 +158,7 @@ namespace NzbDrone.Core.Download.TrackedDownloads
} }
private void LogItemChange(TrackedDownload trackedDownload, DownloadClientItem existingItem, DownloadClientItem downloadItem) private void LogItemChange(TrackedDownload trackedDownload, DownloadClientItem existingItem, DownloadClientItem downloadItem)
{ {
if (existingItem == null || if (existingItem == null ||
existingItem.Status != downloadItem.Status || existingItem.Status != downloadItem.Status ||
existingItem.CanBeRemoved != downloadItem.CanBeRemoved || existingItem.CanBeRemoved != downloadItem.CanBeRemoved ||

@ -142,56 +142,65 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Manual
private ManualImportItem ProcessFile(string rootFolder, string baseFolder, string file, string downloadId, Series series = null) private ManualImportItem ProcessFile(string rootFolder, string baseFolder, string file, string downloadId, Series series = null)
{ {
DownloadClientItem downloadClientItem = null; try
var relativeFile = baseFolder.GetRelativePath(file);
if (series == null)
{
_parsingService.GetSeries(relativeFile.Split('\\', '/')[0]);
}
if (series == null)
{ {
series = _parsingService.GetSeries(relativeFile); DownloadClientItem downloadClientItem = null;
} var relativeFile = baseFolder.GetRelativePath(file);
if (downloadId.IsNotNullOrWhiteSpace())
{
var trackedDownload = _trackedDownloadService.Find(downloadId);
downloadClientItem = trackedDownload?.DownloadItem;
if (series == null) if (series == null)
{ {
series = trackedDownload?.RemoteEpisode?.Series; _parsingService.GetSeries(relativeFile.Split('\\', '/')[0]);
} }
}
if (series == null) if (series == null)
{ {
var relativeParseInfo = Parser.Parser.ParsePath(relativeFile); series = _parsingService.GetSeries(relativeFile);
}
if (relativeParseInfo != null) if (downloadId.IsNotNullOrWhiteSpace())
{ {
series = _seriesService.FindByTitle(relativeParseInfo.SeriesTitle); var trackedDownload = _trackedDownloadService.Find(downloadId);
downloadClientItem = trackedDownload?.DownloadItem;
if (series == null)
{
series = trackedDownload?.RemoteEpisode?.Series;
}
} }
}
if (series == null) if (series == null)
{ {
var localEpisode = new LocalEpisode(); var relativeParseInfo = Parser.Parser.ParsePath(relativeFile);
localEpisode.Path = file;
localEpisode.Quality = QualityParser.ParseQuality(file);
localEpisode.Language = LanguageParser.ParseLanguage(file);
localEpisode.Size = _diskProvider.GetFileSize(file);
return MapItem(new ImportDecision(localEpisode, new Rejection("Unknown Series")), rootFolder, downloadId, null); if (relativeParseInfo != null)
} {
series = _seriesService.FindByTitle(relativeParseInfo.SeriesTitle);
}
}
var importDecisions = _importDecisionMaker.GetImportDecisions(new List<string> {file}, series, downloadClientItem, null, SceneSource(series, baseFolder)); if (series == null)
{
var localEpisode = new LocalEpisode();
localEpisode.Path = file;
localEpisode.Quality = QualityParser.ParseQuality(file);
localEpisode.Language = LanguageParser.ParseLanguage(file);
localEpisode.Size = _diskProvider.GetFileSize(file);
return MapItem(new ImportDecision(localEpisode, new Rejection("Unknown Series")), rootFolder,
downloadId, null);
}
if (importDecisions.Any()) var importDecisions = _importDecisionMaker.GetImportDecisions(new List<string> {file}, series,
downloadClientItem, null, SceneSource(series, baseFolder));
if (importDecisions.Any())
{
return MapItem(importDecisions.First(), rootFolder, downloadId, null);
}
}
catch (Exception ex)
{ {
return MapItem(importDecisions.First(), rootFolder, downloadId, null); _logger.Warn(ex, "Failed to process file: {0}", file);
} }
return new ManualImportItem return new ManualImportItem

Loading…
Cancel
Save