mirror of
https://github.com/Readarr/Readarr
synced 2026-02-03 21:32:04 +01:00
Fixed: Include releases that failed to parse in search results
Signed-off-by: Robin Dadswell <robin@dadswell.email>
This commit is contained in:
parent
649ecd94ea
commit
9216fe28d0
2 changed files with 42 additions and 3 deletions
|
|
@ -152,7 +152,7 @@ public void should_not_attempt_to_map_album_if_not_parsable()
|
|||
GivenSpecifications(_pass1, _pass2, _pass3);
|
||||
_reports[0].Title = "Not parsable";
|
||||
|
||||
var results = Subject.GetRssDecision(_reports).ToList();
|
||||
Subject.GetRssDecision(_reports).ToList();
|
||||
|
||||
Mocker.GetMock<IParsingService>().Verify(c => c.Map(It.IsAny<ParsedBookInfo>(), It.IsAny<SearchCriteriaBase>()), Times.Never());
|
||||
|
||||
|
|
@ -160,11 +160,10 @@ public void should_not_attempt_to_map_album_if_not_parsable()
|
|||
_pass2.Verify(c => c.IsSatisfiedBy(It.IsAny<RemoteBook>(), null), Times.Never());
|
||||
_pass3.Verify(c => c.IsSatisfiedBy(It.IsAny<RemoteBook>(), null), Times.Never());
|
||||
|
||||
results.Should().BeEmpty();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_not_attempt_to_map_album_artist_title_is_blank()
|
||||
public void should_not_attempt_to_map_album_if_artist_title_is_blank()
|
||||
{
|
||||
GivenSpecifications(_pass1, _pass2, _pass3);
|
||||
_reports[0].Title = "2013 - Night Visions";
|
||||
|
|
@ -180,6 +179,24 @@ public void should_not_attempt_to_map_album_artist_title_is_blank()
|
|||
results.Should().BeEmpty();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_rejected_result_for_unparsable_search()
|
||||
{
|
||||
GivenSpecifications(_pass1, _pass2, _pass3);
|
||||
_reports[0].Title = "1937 - Snow White and the Seven Dwarves";
|
||||
|
||||
var artist = new Artist { Name = "Some Artist" };
|
||||
var albums = new List<Album> { new Album { Title = "Some Album" } };
|
||||
|
||||
Subject.GetSearchDecision(_reports, new AlbumSearchCriteria { Artist = artist, Albums = albums }).ToList();
|
||||
|
||||
Mocker.GetMock<IParsingService>().Verify(c => c.Map(It.IsAny<ParsedAlbumInfo>(), It.IsAny<SearchCriteriaBase>()), Times.Never());
|
||||
|
||||
_pass1.Verify(c => c.IsSatisfiedBy(It.IsAny<RemoteAlbum>(), null), Times.Never());
|
||||
_pass2.Verify(c => c.IsSatisfiedBy(It.IsAny<RemoteAlbum>(), null), Times.Never());
|
||||
_pass3.Verify(c => c.IsSatisfiedBy(It.IsAny<RemoteAlbum>(), null), Times.Never());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_not_attempt_to_make_decision_if_artist_is_unknown()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -153,6 +153,28 @@ private IEnumerable<DownloadDecision> GetBookDecisions(List<ReleaseInfo> reports
|
|||
decision = new DownloadDecision(remoteBook, new Rejection("Unable to parse release"));
|
||||
}
|
||||
}
|
||||
|
||||
if (searchCriteria != null)
|
||||
{
|
||||
if (parsedAlbumInfo == null)
|
||||
{
|
||||
parsedAlbumInfo = new ParsedAlbumInfo
|
||||
{
|
||||
Quality = QualityParser.ParseQuality(report.Title, null, 0)
|
||||
};
|
||||
}
|
||||
|
||||
if (parsedAlbumInfo.ArtistName.IsNullOrWhiteSpace())
|
||||
{
|
||||
var remoteAlbum = new RemoteAlbum
|
||||
{
|
||||
Release = report,
|
||||
ParsedAlbumInfo = parsedAlbumInfo
|
||||
};
|
||||
|
||||
decision = new DownloadDecision(remoteAlbum, new Rejection("Unable to parse release"));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue