Now returns one artist back with albums.

pull/4/head
Joseph Milazzo 7 years ago
parent 2813fccc78
commit a08ebcc0c2

@ -9,10 +9,10 @@ namespace NzbDrone.Api.Music
public class AlbumResource
{
public int AlbumId { get; set; }
public string AlbumName { get; set; }
public bool Monitored { get; set; }
//public string Overview { get; set; }
public int Year { get; set; }
//public SeasonStatisticsResource Statistics { get; set; }
public List<string> Genre { get; set; }
}
public static class AlbumResourceMapper
@ -25,8 +25,8 @@ namespace NzbDrone.Api.Music
{
AlbumId = model.AlbumId,
Monitored = model.Monitored,
//Overview = model.Overview; //TODO: Inspect if Album needs an overview
Year = model.Year
Year = model.Year,
AlbumName = model.Title
};
}
@ -38,7 +38,8 @@ namespace NzbDrone.Api.Music
{
AlbumId = resource.AlbumId,
Monitored = resource.Monitored,
Year = resource.Year
Year = resource.Year,
Title = resource.AlbumName
};
}

@ -16,12 +16,10 @@ namespace NzbDrone.Api.Music
Monitored = true;
}
//Todo: Sorters should be done completely on the client
//Todo: Is there an easy way to keep IgnoreArticlesWhenSorting in sync between, Series, History, Missing?
//Todo: We should get the entire Profile instead of ID and Name separately
//View Only
public string ArtistName { get; set; }
public int ItunesId { get; set; }
//public List<AlternateTitleResource> AlternateTitles { get; set; }
//public string SortTitle { get; set; }
@ -55,17 +53,6 @@ namespace NzbDrone.Api.Music
public bool ArtistFolder { get; set; }
public bool Monitored { get; set; }
//public bool UseSceneNumbering { get; set; }
//public int Runtime { get; set; }
//public int TvdbId { get; set; }
//public int TvRageId { get; set; }
//public int TvMazeId { get; set; }
//public DateTime? FirstAired { get; set; }
//public DateTime? LastInfoSync { get; set; }
//public SeriesTypes SeriesType { get; set; }
public string CleanTitle { get; set; }
public int ItunesId { get; set; }
//public string TitleSlug { get; set; }
public string RootFolderPath { get; set; }
public string Certification { get; set; }
public List<string> Genres { get; set; }
@ -119,7 +106,6 @@ namespace NzbDrone.Api.Music
//FirstAired = resource.FirstAired,
//LastInfoSync = resource.LastInfoSync,
//SeriesType = resource.SeriesType,
CleanTitle = model.CleanTitle,
ItunesId = model.ItunesId,
ArtistSlug = model.ArtistSlug,
@ -174,7 +160,6 @@ namespace NzbDrone.Api.Music
//FirstAired = resource.FirstAired,
//LastInfoSync = resource.LastInfoSync,
//SeriesType = resource.SeriesType,
CleanTitle = resource.CleanTitle,
ItunesId = resource.ItunesId,
ArtistSlug = resource.ArtistSlug,

@ -15,6 +15,7 @@ namespace NzbDrone.Core.MetadataSource.SkyHook.Resource
public string ArtistName { get; set; }
public int ArtistId { get; set; }
public string CollectionName { get; set; }
public int CollectionId { get; set; }
}
public class ArtistResource

@ -99,7 +99,7 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
Console.WriteLine("httpRequest: ", httpRequest);
var httpResponse = _httpClient.Get<ArtistResource>(httpRequest);
var httpResponse = _httpClient.Get<List<ShowResource>>(httpRequest);
//Console.WriteLine("Response: ", httpResponse.GetType());
//_logger.Info("Response: ", httpResponse.Resource.ResultCount);
@ -111,7 +111,7 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
tempList.Add(tempSeries);
return tempList;
//return httpResponse.Resource.Results.SelectList(MapArtist);
return httpResponse.Resource.SelectList(MapSeries);
}
catch (HttpException)
{
@ -131,26 +131,26 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
var lowerTitle = title.ToLowerInvariant();
Console.WriteLine("Searching for " + lowerTitle);
//if (lowerTitle.StartsWith("tvdb:") || lowerTitle.StartsWith("tvdbid:"))
//{
// var slug = lowerTitle.Split(':')[1].Trim();
// int tvdbId;
// if (slug.IsNullOrWhiteSpace() || slug.Any(char.IsWhiteSpace) || !int.TryParse(slug, out tvdbId) || tvdbId <= 0)
// {
// return new List<Series>();
// }
// try
// {
// return new List<Series> { GetSeriesInfo(tvdbId).Item1 };
// }
// catch (SeriesNotFoundException)
// {
// return new List<Series>();
// }
//}
if (lowerTitle.StartsWith("itunes:") || lowerTitle.StartsWith("itunesid:"))
{
var slug = lowerTitle.Split(':')[1].Trim();
int itunesId;
if (slug.IsNullOrWhiteSpace() || slug.Any(char.IsWhiteSpace) || !int.TryParse(slug, out itunesId) || itunesId <= 0)
{
return new List<Artist>();
}
//try
//{
// return new List<Artist> { GetArtistInfo(itunesId).Item1 };
//}
//catch (ArtistNotFoundException)
//{
// return new List<Artist>();
//}
}
var httpRequest = _requestBuilder.Create()
.AddQueryParam("entity", "album")
@ -163,15 +163,37 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
var httpResponse = _httpClient.Get<ArtistResource>(httpRequest);
//Console.WriteLine("Response: ", httpResponse.GetType());
//_logger.Info("Response: ", httpResponse.Resource.ResultCount);
//_logger.Info("HTTP Response: ", httpResponse.Resource.ResultCount);
var tempList = new List<Artist>();
var tempSeries = new Artist();
tempSeries.ArtistName = "AFI";
tempList.Add(tempSeries);
return tempList;
//var tempList = new List<Artist>();
//var tempSeries = new Artist();
//tempSeries.ArtistName = "AFI";
//tempList.Add(tempSeries);
//return tempList;
Album tempAlbum;
// TODO: This needs to handle multiple artists.
Artist artist = new Artist();
artist.ArtistName = httpResponse.Resource.Results[0].ArtistName;
artist.ItunesId = httpResponse.Resource.Results[0].ArtistId;
foreach (var album in httpResponse.Resource.Results)
{
tempAlbum = new Album();
tempAlbum.AlbumId = album.CollectionId;
tempAlbum.Title = album.CollectionName;
artist.Albums.Add(tempAlbum);
}
var temp = new List<Artist>();
temp.Add(artist);
return temp;
// I need to return a list of mapped artists.
//return httpResponse.Resource.Results.SelectList(MapArtist);
}
@ -189,7 +211,7 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
private static Artist MapArtist(ArtistResource artistQuery)
{
var artist = new Artist();
//artist.ItunesId = artistQuery.artistId;
//artist.ItunesId = artistQuery.ItunesId; ;
// artist.ArtistName = artistQuery.ArtistName;

@ -15,7 +15,7 @@ namespace NzbDrone.Core.Music
}
public int AlbumId { get; set; }
public string Title { get; set; }
public string Title { get; set; } // NOTE: This should be CollectionName in API
public int Year { get; set; }
public int TrackCount { get; set; }
public int DiscCount { get; set; }

Loading…
Cancel
Save