我目前正在使用由Park Square制作的C#包装器来使用Gracenote Web API,我不知道如何设置详细级别。
目前Search()方法只返回流派,情绪,节奏等的一个细节级别,但我希望尽可能详细。
目前我的代码如下:
var gnRes = gnClient.Search(new SearchCriteria {
AlbumTitle = albumName,
Artist = artistName,
TrackTitle = trackTitle,
SearchMode = SearchMode.BestMatchWithCoverArt,
SearchOptions = SearchOptions.Mood | SearchOptions.Tempo | SearchOptions.ArtistOriginEraType
});
我发现SearchCriteria对象有一个ResponseDetail类,表明确实可以设置详细级别,但我不知道如何正确使用它。为包装器发布的doumentation没有提到它。
答案 0 :(得分:0)
我发现了如何做到这一点并获得我想要的响应类型。
SearchCriteria searchCriteria = new SearchCriteria();
ResponseDetail detail = new ResponseDetail();
detail.GenreLevels = ResponseDetail.Level.Three;
detail.MoodLevels = ResponseDetail.Level.Two;
detail.TempoLevels = ResponseDetail.Level.Three;
detail.ArtistEraLevels = ResponseDetail.Level.Two;
detail.ArtistOriginLevels = ResponseDetail.Level.Four;
detail.ArtistTypeLevels = ResponseDetail.Level.Two;
searchCriteria.AlbumTitle = albumTitle;
searchCriteria.Artist = artistName;
searchCriteria.TrackTitle = trackTitle;
searchCriteria.SearchMode = SearchMode.BestMatch;
searchCriteria.SearchOptions = SearchOptions.Mood | SearchOptions.Tempo | SearchOptions.ArtistOriginEraType;
searchCriteria.ResponseDetail = detail;
SearchResult gnRes = gnClient.Search(searchCriteria);