Fixed: Run import identification even for unparsable releases

pull/965/head
ta264 4 years ago
parent f0742e3750
commit 3940d4aa28

@ -1,4 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using FluentAssertions; using FluentAssertions;
using Moq; using Moq;
@ -146,7 +146,7 @@ namespace NzbDrone.Core.Test.Download.CompletedDownloadServiceTests
} }
[Test] [Test]
public void should_not_process_if_the_download_cannot_be_tracked_using_the_source_title_as_it_was_initiated_externally() public void should_process_if_the_download_cannot_be_tracked_using_the_source_title_as_it_was_initiated_externally()
{ {
GivenABadlyNamedDownload(); GivenABadlyNamedDownload();
_trackedDownload.RemoteBook.Author = null; _trackedDownload.RemoteBook.Author = null;
@ -156,11 +156,11 @@ namespace NzbDrone.Core.Test.Download.CompletedDownloadServiceTests
Subject.Check(_trackedDownload); Subject.Check(_trackedDownload);
AssertNotReadyToImport(); AssertReadyToImport();
} }
[Test] [Test]
public void should_not_process_when_there_is_a_title_mismatch() public void should_process_when_there_is_a_title_mismatch()
{ {
_trackedDownload.RemoteBook.Author = null; _trackedDownload.RemoteBook.Author = null;
Mocker.GetMock<IParsingService>() Mocker.GetMock<IParsingService>()
@ -169,7 +169,7 @@ namespace NzbDrone.Core.Test.Download.CompletedDownloadServiceTests
Subject.Check(_trackedDownload); Subject.Check(_trackedDownload);
AssertNotReadyToImport(); AssertReadyToImport();
} }
private void AssertNotReadyToImport() private void AssertNotReadyToImport()

@ -123,7 +123,7 @@ namespace NzbDrone.Core.Test.MediaFiles
} }
[Test] [Test]
public void should_skip_if_no_author_found() public void should_not_skip_if_no_author_found()
{ {
Mocker.GetMock<IParsingService>().Setup(c => c.GetAuthor("foldername")).Returns((Author)null); Mocker.GetMock<IParsingService>().Setup(c => c.GetAuthor("foldername")).Returns((Author)null);
@ -131,9 +131,9 @@ namespace NzbDrone.Core.Test.MediaFiles
Mocker.GetMock<IMakeImportDecision>() Mocker.GetMock<IMakeImportDecision>()
.Verify(c => c.GetImportDecisions(It.IsAny<List<IFileInfo>>(), It.IsAny<IdentificationOverrides>(), It.IsAny<ImportDecisionMakerInfo>(), It.IsAny<ImportDecisionMakerConfig>()), .Verify(c => c.GetImportDecisions(It.IsAny<List<IFileInfo>>(), It.IsAny<IdentificationOverrides>(), It.IsAny<ImportDecisionMakerInfo>(), It.IsAny<ImportDecisionMakerConfig>()),
Times.Never()); Times.Once());
VerifyNoImport(); VerifyImport();
} }
[Test] [Test]

@ -46,8 +46,7 @@ namespace NzbDrone.Core.Download
public void Check(TrackedDownload trackedDownload) public void Check(TrackedDownload trackedDownload)
{ {
if (trackedDownload.DownloadItem.Status != DownloadItemStatus.Completed || if (trackedDownload.DownloadItem.Status != DownloadItemStatus.Completed)
trackedDownload.RemoteBook == null)
{ {
return; return;
} }
@ -83,22 +82,6 @@ namespace NzbDrone.Core.Download
return; return;
} }
var author = trackedDownload.RemoteBook.Author;
if (author == null)
{
if (historyItem != null)
{
author = _authorService.GetAuthor(historyItem.AuthorId);
}
if (author == null)
{
trackedDownload.Warn("Author name mismatch, automatic import is not possible.");
return;
}
}
trackedDownload.State = TrackedDownloadState.ImportPending; trackedDownload.State = TrackedDownloadState.ImportPending;
} }
@ -107,7 +90,7 @@ namespace NzbDrone.Core.Download
trackedDownload.State = TrackedDownloadState.Importing; trackedDownload.State = TrackedDownloadState.Importing;
var outputPath = trackedDownload.ImportItem.OutputPath.FullPath; var outputPath = trackedDownload.ImportItem.OutputPath.FullPath;
var importResults = _downloadedTracksImportService.ProcessPath(outputPath, ImportMode.Auto, trackedDownload.RemoteBook.Author, trackedDownload.DownloadItem); var importResults = _downloadedTracksImportService.ProcessPath(outputPath, ImportMode.Auto, trackedDownload.RemoteBook?.Author, trackedDownload.DownloadItem);
if (importResults.Empty()) if (importResults.Empty())
{ {
@ -142,7 +125,7 @@ namespace NzbDrone.Core.Download
{ {
var allItemsImported = importResults.Where(c => c.Result == ImportResultType.Imported) var allItemsImported = importResults.Where(c => c.Result == ImportResultType.Imported)
.Select(c => c.ImportDecision.Item.Book) .Select(c => c.ImportDecision.Item.Book)
.Count() >= Math.Max(1, trackedDownload.RemoteBook.Books.Count); .Count() >= Math.Max(1, trackedDownload.RemoteBook?.Books.Count ?? 1);
if (allItemsImported) if (allItemsImported)
{ {

@ -194,7 +194,6 @@ namespace NzbDrone.Core.Download.TrackedDownloads
if (trackedDownload.RemoteBook == null) if (trackedDownload.RemoteBook == null)
{ {
_logger.Trace("No Book found for download '{0}'", trackedDownload.DownloadItem.Title); _logger.Trace("No Book found for download '{0}'", trackedDownload.DownloadItem.Title);
trackedDownload.Warn("No Book found for download '{0}'", trackedDownload.DownloadItem.Title);
} }
} }
catch (Exception e) catch (Exception e)

@ -151,16 +151,6 @@ namespace NzbDrone.Core.MediaFiles
var cleanedUpName = GetCleanedUpFolderName(directoryInfo.Name); var cleanedUpName = GetCleanedUpFolderName(directoryInfo.Name);
var author = _parsingService.GetAuthor(cleanedUpName); var author = _parsingService.GetAuthor(cleanedUpName);
if (author == null)
{
_logger.Debug("Unknown Author {0}", cleanedUpName);
return new List<ImportResult>
{
UnknownAuthorResult("Unknown Author")
};
}
return ProcessFolder(directoryInfo, importMode, author, downloadClientItem); return ProcessFolder(directoryInfo, importMode, author, downloadClientItem);
} }

Loading…
Cancel
Save