mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-19 21:03:17 -07:00
Fixed the artist search in ombi
Make minor improvements to the new search result
This commit is contained in:
parent
2ffec6b1e6
commit
df74e38672
14 changed files with 141 additions and 51 deletions
|
@ -9,5 +9,6 @@ namespace Ombi.Core.Engine.Interfaces
|
|||
Task<ArtistInformation> GetArtistInformation(string artistId);
|
||||
Task<ArtistInformation> GetArtistInformationByRequestId(int requestId);
|
||||
Task<AlbumArt> GetReleaseGroupArt(string musicBrainzId, CancellationToken token);
|
||||
Task<ReleaseGroup> GetAlbum(string albumId);
|
||||
}
|
||||
}
|
|
@ -5,6 +5,7 @@ using System.Linq;
|
|||
using System.Security.Principal;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using Ombi.Api.Lidarr;
|
||||
using Ombi.Api.Lidarr.Models;
|
||||
using Ombi.Api.MusicBrainz;
|
||||
|
@ -41,6 +42,21 @@ namespace Ombi.Core.Engine.V2
|
|||
_lidarrApi = lidarrApi;
|
||||
}
|
||||
|
||||
public async Task<ReleaseGroup> GetAlbum(string albumId)
|
||||
{
|
||||
var g = await _musicBrainzApi.GetAlbumInformation(albumId);
|
||||
var release = new ReleaseGroup
|
||||
{
|
||||
ReleaseType = g.ReleaseGroup.PrimaryType,
|
||||
Id = g.Id,
|
||||
Title = g.Title,
|
||||
ReleaseDate = g.ReleaseGroup.FirstReleaseDate,
|
||||
};
|
||||
|
||||
await RunSearchRules(release);
|
||||
return release;
|
||||
}
|
||||
|
||||
public async Task<ArtistInformation> GetArtistInformation(string artistId)
|
||||
{
|
||||
var artist = await _musicBrainzApi.GetArtistInformation(artistId);
|
||||
|
@ -84,12 +100,19 @@ namespace Ombi.Core.Engine.V2
|
|||
|
||||
if (lidarrArtistTask != null)
|
||||
{
|
||||
var artistResult = await lidarrArtistTask;
|
||||
info.Banner = artistResult.images?.FirstOrDefault(x => x.coverType.Equals("banner", StringComparison.InvariantCultureIgnoreCase))?.url.ToHttpsUrl();
|
||||
info.Logo = artistResult.images?.FirstOrDefault(x => x.coverType.Equals("logo", StringComparison.InvariantCultureIgnoreCase))?.url.ToHttpsUrl();
|
||||
info.Poster = artistResult.images?.FirstOrDefault(x => x.coverType.Equals("poster", StringComparison.InvariantCultureIgnoreCase))?.url.ToHttpsUrl();
|
||||
info.FanArt = artistResult.images?.FirstOrDefault(x => x.coverType.Equals("fanart", StringComparison.InvariantCultureIgnoreCase))?.url.ToHttpsUrl();
|
||||
info.Overview = artistResult.overview;
|
||||
try
|
||||
{
|
||||
var artistResult = await lidarrArtistTask;
|
||||
info.Banner = artistResult.images?.FirstOrDefault(x => x.coverType.Equals("banner", StringComparison.InvariantCultureIgnoreCase))?.url.ToHttpsUrl();
|
||||
info.Logo = artistResult.images?.FirstOrDefault(x => x.coverType.Equals("logo", StringComparison.InvariantCultureIgnoreCase))?.url.ToHttpsUrl();
|
||||
info.Poster = artistResult.images?.FirstOrDefault(x => x.coverType.Equals("poster", StringComparison.InvariantCultureIgnoreCase))?.url.ToHttpsUrl();
|
||||
info.FanArt = artistResult.images?.FirstOrDefault(x => x.coverType.Equals("fanart", StringComparison.InvariantCultureIgnoreCase))?.url.ToHttpsUrl();
|
||||
info.Overview = artistResult.overview;
|
||||
}
|
||||
catch (JsonSerializationException)
|
||||
{
|
||||
// swallow, Lidarr probably doesn't have this artist
|
||||
}
|
||||
}
|
||||
|
||||
return info;
|
||||
|
@ -118,7 +141,7 @@ namespace Ombi.Core.Engine.V2
|
|||
|
||||
return new AlbumArt();
|
||||
}
|
||||
|
||||
|
||||
public async Task<ArtistInformation> GetArtistInformationByRequestId(int requestId)
|
||||
{
|
||||
var request = await RequestService.MusicRequestRepository.Find(requestId);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue