mirror of https://github.com/lidarr/Lidarr
Fixed: Remove albums with no acceptable releases from search results
This commit is contained in:
parent
879038ee0b
commit
23f8ec1f20
|
@ -292,7 +292,9 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
|
||||||
|
|
||||||
var httpResponse = _httpClient.Get<List<AlbumResource>>(httpRequest);
|
var httpResponse = _httpClient.Get<List<AlbumResource>>(httpRequest);
|
||||||
|
|
||||||
return httpResponse.Resource.SelectList(MapSearchResult);
|
return httpResponse.Resource.Select(MapSearchResult)
|
||||||
|
.Where(x => x != null)
|
||||||
|
.ToList();
|
||||||
}
|
}
|
||||||
catch (HttpException)
|
catch (HttpException)
|
||||||
{
|
{
|
||||||
|
@ -317,7 +319,9 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
|
||||||
|
|
||||||
var httpResponse = _httpClient.Post<List<AlbumResource>>(httpRequest);
|
var httpResponse = _httpClient.Post<List<AlbumResource>>(httpRequest);
|
||||||
|
|
||||||
return httpResponse.Resource.SelectList(MapSearchResult);
|
return httpResponse.Resource.Select(MapSearchResult)
|
||||||
|
.Where(x => x != null)
|
||||||
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<object> SearchForNewEntity(string title)
|
public List<object> SearchForNewEntity(string title)
|
||||||
|
@ -335,7 +339,15 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
|
||||||
var album = SearchForNewAlbum(lowerTitle, null);
|
var album = SearchForNewAlbum(lowerTitle, null);
|
||||||
if (album.Any())
|
if (album.Any())
|
||||||
{
|
{
|
||||||
return new List<object> { album.First() };
|
var result = album.Where(x => x.AlbumReleases.Value.Any()).FirstOrDefault();
|
||||||
|
if (result != null)
|
||||||
|
{
|
||||||
|
return new List<object> { result };
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return new List<object>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -344,12 +356,14 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
|
||||||
var httpRequest = _requestBuilder.GetRequestBuilder().Create()
|
var httpRequest = _requestBuilder.GetRequestBuilder().Create()
|
||||||
.SetSegment("route", "search")
|
.SetSegment("route", "search")
|
||||||
.AddQueryParam("type", "all")
|
.AddQueryParam("type", "all")
|
||||||
.AddQueryParam("query", title.ToLower().Trim())
|
.AddQueryParam("query", lowerTitle.Trim())
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
var httpResponse = _httpClient.Get<List<EntityResource>>(httpRequest);
|
var httpResponse = _httpClient.Get<List<EntityResource>>(httpRequest);
|
||||||
|
|
||||||
return httpResponse.Resource.SelectList(MapSearchResult);
|
return httpResponse.Resource.Select(MapSearchResult)
|
||||||
|
.Where(x => x != null)
|
||||||
|
.ToList();
|
||||||
}
|
}
|
||||||
catch (HttpException)
|
catch (HttpException)
|
||||||
{
|
{
|
||||||
|
@ -394,6 +408,11 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
|
||||||
album.Artist = artist;
|
album.Artist = artist;
|
||||||
album.ArtistMetadata = artist.Metadata.Value;
|
album.ArtistMetadata = artist.Metadata.Value;
|
||||||
|
|
||||||
|
if (!album.AlbumReleases.Value.Any())
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return album;
|
return album;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue