Fixed: Manual Import failing to show files when processing fails
This commit is contained in:
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]);
|
DownloadClientItem downloadClientItem = null;
|
||||||
}
|
var relativeFile = baseFolder.GetRelativePath(file);
|
||||||
|
|
||||||
if (series == null)
|
|
||||||
{
|
|
||||||
series = _parsingService.GetSeries(relativeFile);
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
if (relativeParseInfo != null)
|
|
||||||
{
|
{
|
||||||
series = _seriesService.FindByTitle(relativeParseInfo.SeriesTitle);
|
series = _parsingService.GetSeries(relativeFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (downloadId.IsNotNullOrWhiteSpace())
|
||||||
|
{
|
||||||
|
var trackedDownload = _trackedDownloadService.Find(downloadId);
|
||||||
|
downloadClientItem = trackedDownload?.DownloadItem;
|
||||||
|
|
||||||
|
if (series == null)
|
||||||
|
{
|
||||||
|
series = trackedDownload?.RemoteEpisode?.Series;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (series == null)
|
||||||
|
{
|
||||||
|
var relativeParseInfo = Parser.Parser.ParsePath(relativeFile);
|
||||||
|
|
||||||
|
if (relativeParseInfo != null)
|
||||||
|
{
|
||||||
|
series = _seriesService.FindByTitle(relativeParseInfo.SeriesTitle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
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)
|
||||||
if (series == null)
|
|
||||||
{
|
{
|
||||||
var localEpisode = new LocalEpisode();
|
_logger.Warn(ex, "Failed to process file: {0}", file);
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
var importDecisions = _importDecisionMaker.GetImportDecisions(new List<string> {file}, series, downloadClientItem, null, SceneSource(series, baseFolder));
|
|
||||||
|
|
||||||
if (importDecisions.Any())
|
|
||||||
{
|
|
||||||
return MapItem(importDecisions.First(), rootFolder, downloadId, null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ManualImportItem
|
return new ManualImportItem
|
||||||
|
|
Loading…
Reference in New Issue