mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-11-15 18:08:53 -07:00
Fix MusicBrainz album queries and releasegroup handling
This commit is contained in:
parent
4baa534679
commit
3c921e25da
@ -76,13 +76,13 @@ public class MusicBrainzAlbumProvider : IRemoteMetadataProvider<MusicAlbum, Albu
|
|||||||
|
|
||||||
if (!string.IsNullOrEmpty(releaseId))
|
if (!string.IsNullOrEmpty(releaseId))
|
||||||
{
|
{
|
||||||
var releaseResult = await _musicBrainzQuery.LookupReleaseAsync(new Guid(releaseId), Include.ReleaseGroups, cancellationToken).ConfigureAwait(false);
|
var releaseResult = await _musicBrainzQuery.LookupReleaseAsync(new Guid(releaseId), Include.Artists | Include.ReleaseGroups, cancellationToken).ConfigureAwait(false);
|
||||||
return GetReleaseResult(releaseResult).SingleItemAsEnumerable();
|
return GetReleaseResult(releaseResult).SingleItemAsEnumerable();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(releaseGroupId))
|
if (!string.IsNullOrEmpty(releaseGroupId))
|
||||||
{
|
{
|
||||||
var releaseGroupResult = await _musicBrainzQuery.LookupReleaseGroupAsync(new Guid(releaseGroupId), Include.None, null, cancellationToken).ConfigureAwait(false);
|
var releaseGroupResult = await _musicBrainzQuery.LookupReleaseGroupAsync(new Guid(releaseGroupId), Include.Releases, null, cancellationToken).ConfigureAwait(false);
|
||||||
return GetReleaseGroupResult(releaseGroupResult.Releases);
|
return GetReleaseGroupResult(releaseGroupResult.Releases);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,7 +137,9 @@ public class MusicBrainzAlbumProvider : IRemoteMetadataProvider<MusicAlbum, Albu
|
|||||||
|
|
||||||
foreach (var result in releaseSearchResults)
|
foreach (var result in releaseSearchResults)
|
||||||
{
|
{
|
||||||
yield return GetReleaseResult(result);
|
// Fetch full release info, otherwise artists are missing
|
||||||
|
var fullResult = _musicBrainzQuery.LookupRelease(result.Id, Include.Artists | Include.ReleaseGroups);
|
||||||
|
yield return GetReleaseResult(fullResult);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,21 +149,33 @@ public class MusicBrainzAlbumProvider : IRemoteMetadataProvider<MusicAlbum, Albu
|
|||||||
{
|
{
|
||||||
Name = releaseSearchResult.Title,
|
Name = releaseSearchResult.Title,
|
||||||
ProductionYear = releaseSearchResult.Date?.Year,
|
ProductionYear = releaseSearchResult.Date?.Year,
|
||||||
PremiereDate = releaseSearchResult.Date?.NearestDate
|
PremiereDate = releaseSearchResult.Date?.NearestDate,
|
||||||
|
SearchProviderName = Name
|
||||||
};
|
};
|
||||||
|
|
||||||
if (releaseSearchResult.ArtistCredit?.Count > 0)
|
// Add artists and use first as album artist
|
||||||
|
var artists = releaseSearchResult.ArtistCredit;
|
||||||
|
if (artists is not null && artists.Count > 0)
|
||||||
{
|
{
|
||||||
searchResult.AlbumArtist = new RemoteSearchResult
|
var artistResults = new List<RemoteSearchResult>();
|
||||||
{
|
|
||||||
SearchProviderName = Name,
|
|
||||||
Name = releaseSearchResult.ArtistCredit[0].Name
|
|
||||||
};
|
|
||||||
|
|
||||||
if (releaseSearchResult.ArtistCredit[0].Artist?.Id is not null)
|
foreach (var artist in artists)
|
||||||
{
|
{
|
||||||
searchResult.AlbumArtist.SetProviderId(MetadataProvider.MusicBrainzArtist, releaseSearchResult.ArtistCredit[0].Artist!.Id.ToString());
|
var artistResult = new RemoteSearchResult
|
||||||
|
{
|
||||||
|
Name = artist.Name
|
||||||
|
};
|
||||||
|
|
||||||
|
if (artist.Artist?.Id is not null)
|
||||||
|
{
|
||||||
|
artistResult.SetProviderId(MetadataProvider.MusicBrainzArtist, artist.Artist!.Id.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
artistResults.Add(artistResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
searchResult.AlbumArtist = artistResults[0];
|
||||||
|
searchResult.Artists = artistResults.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
searchResult.SetProviderId(MetadataProvider.MusicBrainzAlbum, releaseSearchResult.Id.ToString());
|
searchResult.SetProviderId(MetadataProvider.MusicBrainzAlbum, releaseSearchResult.Id.ToString());
|
||||||
|
@ -116,7 +116,8 @@ public class MusicBrainzArtistProvider : IRemoteMetadataProvider<MusicArtist, Ar
|
|||||||
{
|
{
|
||||||
Name = artist.Name,
|
Name = artist.Name,
|
||||||
ProductionYear = artist.LifeSpan?.Begin?.Year,
|
ProductionYear = artist.LifeSpan?.Begin?.Year,
|
||||||
PremiereDate = artist.LifeSpan?.Begin?.NearestDate
|
PremiereDate = artist.LifeSpan?.Begin?.NearestDate,
|
||||||
|
SearchProviderName = Name,
|
||||||
};
|
};
|
||||||
|
|
||||||
searchResult.SetProviderId(MetadataProvider.MusicBrainzArtist, artist.Id.ToString());
|
searchResult.SetProviderId(MetadataProvider.MusicBrainzArtist, artist.Id.ToString());
|
||||||
|
Loading…
Reference in New Issue
Block a user