Skip to content

Commit

Permalink
search for album by album artist if artist has no children
Browse files Browse the repository at this point in the history
  • Loading branch information
Viperinius committed Mar 5, 2024
1 parent e585110 commit 065b8d3
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion Viperinius.Plugin.SpotifyImport/PlaylistSync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,18 @@ private bool CheckAlbumArtist(MusicAlbum album, ProviderTrackInfo providerTrackI

private MusicAlbum? GetAlbum(MusicArtist artist, ProviderTrackInfo providerTrackInfo, ref int nextAlbumIndex)
{
var item = artist.Children.ElementAtOrDefault(nextAlbumIndex);
var albums = artist.Children;
if (!artist.Children.Any())
{
// for whatever reason albums are apparently not always set as children of the artist... so try to find them using album artist
albums = _libraryManager.GetItemList(new MediaBrowser.Controller.Entities.InternalItemsQuery
{
AlbumArtistIds = new[] { artist.Id },
IncludeItemTypes = new[] { BaseItemKind.MusicAlbum }
});
}

var item = albums.ElementAtOrDefault(nextAlbumIndex);
nextAlbumIndex++;
if (item == null)
{
Expand Down

0 comments on commit 065b8d3

Please sign in to comment.