mirror of
https://github.com/Readarr/Readarr
synced 2025-12-26 18:22:32 +01:00
Fixed: Run import identification even for unparsable releases
This commit is contained in:
parent
f0742e3750
commit
3940d4aa28
5 changed files with 11 additions and 39 deletions
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
|
|
@ -146,7 +146,7 @@ public void should_not_process_if_output_path_is_empty()
|
|||
}
|
||||
|
||||
[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 @@ public void should_not_process_if_the_download_cannot_be_tracked_using_the_sourc
|
|||
|
||||
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 @@ public void should_not_process_when_there_is_a_title_mismatch()
|
|||
|
||||
Subject.Check(_trackedDownload);
|
||||
|
||||
AssertNotReadyToImport();
|
||||
AssertReadyToImport();
|
||||
}
|
||||
|
||||
private void AssertNotReadyToImport()
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ public void should_skip_if_file_is_in_use_by_another_process()
|
|||
}
|
||||
|
||||
[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 @@ public void should_skip_if_no_author_found()
|
|||
|
||||
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 @@ public CompletedDownloadService(IEventAggregator eventAggregator,
|
|||
|
||||
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 @@ public void Check(TrackedDownload trackedDownload)
|
|||
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 @@ public void Import(TrackedDownload trackedDownload)
|
|||
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 @@ public bool VerifyImport(TrackedDownload trackedDownload, List<ImportResult> imp
|
|||
{
|
||||
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 @@ public TrackedDownload TrackDownload(DownloadClientDefinition downloadClient, Do
|
|||
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 @@ private List<ImportResult> ProcessFolder(IDirectoryInfo directoryInfo, ImportMod
|
|||
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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue