mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 13:33:34 -07:00
Fixed: Include releases that failed to parse in search results
This commit is contained in:
parent
d72014eb66
commit
10b7d0d63e
3 changed files with 44 additions and 8 deletions
|
@ -159,9 +159,8 @@ namespace Lidarr.Api.V1.Indexers
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.Error(ex, "Album search failed");
|
_logger.Error(ex, "Album search failed");
|
||||||
|
throw new NzbDroneClientException(HttpStatusCode.InternalServerError, ex.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new List<ReleaseResource>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<ReleaseResource> GetArtistReleases(int artistId)
|
private List<ReleaseResource> GetArtistReleases(int artistId)
|
||||||
|
@ -176,9 +175,8 @@ namespace Lidarr.Api.V1.Indexers
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.Error(ex, "Artist search failed");
|
_logger.Error(ex, "Artist search failed");
|
||||||
|
throw new NzbDroneClientException(HttpStatusCode.InternalServerError, ex.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new List<ReleaseResource>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<ReleaseResource> GetRss()
|
private List<ReleaseResource> GetRss()
|
||||||
|
|
|
@ -152,19 +152,17 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||||
GivenSpecifications(_pass1, _pass2, _pass3);
|
GivenSpecifications(_pass1, _pass2, _pass3);
|
||||||
_reports[0].Title = "Not parsable";
|
_reports[0].Title = "Not parsable";
|
||||||
|
|
||||||
var results = Subject.GetRssDecision(_reports).ToList();
|
Subject.GetRssDecision(_reports).ToList();
|
||||||
|
|
||||||
Mocker.GetMock<IParsingService>().Verify(c => c.Map(It.IsAny<ParsedAlbumInfo>(), It.IsAny<SearchCriteriaBase>()), Times.Never());
|
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());
|
_pass1.Verify(c => c.IsSatisfiedBy(It.IsAny<RemoteAlbum>(), null), Times.Never());
|
||||||
_pass2.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());
|
_pass3.Verify(c => c.IsSatisfiedBy(It.IsAny<RemoteAlbum>(), null), Times.Never());
|
||||||
|
|
||||||
results.Should().BeEmpty();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[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);
|
GivenSpecifications(_pass1, _pass2, _pass3);
|
||||||
_reports[0].Title = "2013 - Night Visions";
|
_reports[0].Title = "2013 - Night Visions";
|
||||||
|
@ -180,6 +178,24 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||||
results.Should().BeEmpty();
|
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]
|
[Test]
|
||||||
public void should_not_attempt_to_make_decision_if_artist_is_unknown()
|
public void should_not_attempt_to_make_decision_if_artist_is_unknown()
|
||||||
{
|
{
|
||||||
|
|
|
@ -140,6 +140,28 @@ namespace NzbDrone.Core.DecisionEngine
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue