mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-19 13:10:13 -07:00
Multiple artists return to UI
This commit is contained in:
parent
a08ebcc0c2
commit
de21685896
2 changed files with 37 additions and 8 deletions
|
@ -175,23 +175,38 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
|
||||||
//return tempList;
|
//return tempList;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Album tempAlbum;
|
Album tempAlbum;
|
||||||
// TODO: This needs to handle multiple artists.
|
List<Artist> artists = new List<Artist>();
|
||||||
Artist artist = new Artist();
|
ArtistComparer artistComparer = new ArtistComparer();
|
||||||
artist.ArtistName = httpResponse.Resource.Results[0].ArtistName;
|
|
||||||
artist.ItunesId = httpResponse.Resource.Results[0].ArtistId;
|
|
||||||
foreach (var album in httpResponse.Resource.Results)
|
foreach (var album in httpResponse.Resource.Results)
|
||||||
{
|
{
|
||||||
tempAlbum = new Album();
|
tempAlbum = new Album();
|
||||||
|
// TODO: Perform MapAlbum call here
|
||||||
tempAlbum.AlbumId = album.CollectionId;
|
tempAlbum.AlbumId = album.CollectionId;
|
||||||
tempAlbum.Title = album.CollectionName;
|
tempAlbum.Title = album.CollectionName;
|
||||||
|
|
||||||
artist.Albums.Add(tempAlbum);
|
|
||||||
|
int index = artists.FindIndex(a => a.ItunesId == album.ArtistId);
|
||||||
|
|
||||||
|
|
||||||
|
if (index >= 0)
|
||||||
|
{
|
||||||
|
artists[index].Albums.Add(tempAlbum);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Artist tempArtist = new Artist();
|
||||||
|
// TODO: Perform the MapArtist call here
|
||||||
|
tempArtist.ItunesId = album.ArtistId;
|
||||||
|
tempArtist.ArtistName = album.ArtistName;
|
||||||
|
tempArtist.Albums.Add(tempAlbum);
|
||||||
|
artists.Add(tempArtist);
|
||||||
}
|
}
|
||||||
|
|
||||||
var temp = new List<Artist>();
|
}
|
||||||
temp.Add(artist);
|
|
||||||
return temp;
|
return artists;
|
||||||
|
|
||||||
// I need to return a list of mapped artists.
|
// I need to return a list of mapped artists.
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,20 @@ using System.Text;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Music
|
namespace NzbDrone.Core.Music
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public class ArtistComparer : IEqualityComparer<Artist>
|
||||||
|
{
|
||||||
|
public bool Equals(Artist x, Artist y)
|
||||||
|
{
|
||||||
|
return x.ItunesId == y.ItunesId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int GetHashCode(Artist obj)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public class Artist : ModelBase
|
public class Artist : ModelBase
|
||||||
{
|
{
|
||||||
public Artist()
|
public Artist()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue