mirror of
https://github.com/fergalmoran/Readarr.git
synced 2026-01-09 02:06:56 +00:00
Fixed: Run import identification even for unparsable releases
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
@@ -146,7 +146,7 @@ namespace NzbDrone.Core.Test.Download.CompletedDownloadServiceTests
|
||||
}
|
||||
|
||||
[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();
|
||||
_trackedDownload.RemoteBook.Author = null;
|
||||
@@ -156,11 +156,11 @@ namespace NzbDrone.Core.Test.Download.CompletedDownloadServiceTests
|
||||
|
||||
Subject.Check(_trackedDownload);
|
||||
|
||||
AssertNotReadyToImport();
|
||||
AssertReadyToImport();
|
||||
}
|
||||
|
||||
[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;
|
||||
Mocker.GetMock<IParsingService>()
|
||||
@@ -169,7 +169,7 @@ namespace NzbDrone.Core.Test.Download.CompletedDownloadServiceTests
|
||||
|
||||
Subject.Check(_trackedDownload);
|
||||
|
||||
AssertNotReadyToImport();
|
||||
AssertReadyToImport();
|
||||
}
|
||||
|
||||
private void AssertNotReadyToImport()
|
||||
|
||||
@@ -123,7 +123,7 @@ namespace NzbDrone.Core.Test.MediaFiles
|
||||
}
|
||||
|
||||
[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);
|
||||
|
||||
@@ -131,9 +131,9 @@ namespace NzbDrone.Core.Test.MediaFiles
|
||||
|
||||
Mocker.GetMock<IMakeImportDecision>()
|
||||
.Verify(c => c.GetImportDecisions(It.IsAny<List<IFileInfo>>(), It.IsAny<IdentificationOverrides>(), It.IsAny<ImportDecisionMakerInfo>(), It.IsAny<ImportDecisionMakerConfig>()),
|
||||
Times.Never());
|
||||
Times.Once());
|
||||
|
||||
VerifyNoImport();
|
||||
VerifyImport();
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -46,8 +46,7 @@ namespace NzbDrone.Core.Download
|
||||
|
||||
public void Check(TrackedDownload trackedDownload)
|
||||
{
|
||||
if (trackedDownload.DownloadItem.Status != DownloadItemStatus.Completed ||
|
||||
trackedDownload.RemoteBook == null)
|
||||
if (trackedDownload.DownloadItem.Status != DownloadItemStatus.Completed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -83,22 +82,6 @@ namespace NzbDrone.Core.Download
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -107,7 +90,7 @@ namespace NzbDrone.Core.Download
|
||||
trackedDownload.State = TrackedDownloadState.Importing;
|
||||
|
||||
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())
|
||||
{
|
||||
@@ -142,7 +125,7 @@ namespace NzbDrone.Core.Download
|
||||
{
|
||||
var allItemsImported = importResults.Where(c => c.Result == ImportResultType.Imported)
|
||||
.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)
|
||||
{
|
||||
|
||||
@@ -194,7 +194,6 @@ namespace NzbDrone.Core.Download.TrackedDownloads
|
||||
if (trackedDownload.RemoteBook == null)
|
||||
{
|
||||
_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)
|
||||
|
||||
@@ -151,16 +151,6 @@ namespace NzbDrone.Core.MediaFiles
|
||||
var cleanedUpName = GetCleanedUpFolderName(directoryInfo.Name);
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user