我正在尝试使用第 3 方 java 库从 MusicBrainz 下载元数据:musicbrainzws2-java
我正在尝试检索指定专辑中单首歌曲的元数据。我已经检索了专辑的 MBID,但是当我尝试搜索专辑中的歌曲时,我没有得到任何回报。
这是我的代码:
public static void main (String args []) throws MBWS2Exception {
String artistName = "Imagine Dragons";
String album_id = null;
Artist artist = new Artist();
artist.search(artistName);
List<ArtistResultWs2> results = artist.getFullSearchResultList();
ArtistWs2 song = results.get(0).getArtist();
artist = new Artist();
song = artist.lookUp(song);
List<ReleaseGroupWs2> rgl = artist.getFullReleaseGroupList();
for(int i =0; i<rgl.size(); i++){
System.out.println(rgl.get(i).getTitle());
if(rgl.get(i).getTitle().equals("Night Visions")){
album_id = rgl.get(i).getId();
}
}
System.out.println("Night visions ID: " + album_id);
Release release = new Release();
release.search(album_id);
List<ReleaseResultWs2> list = release.getFullSearchResultList();
for(int i =0; i<list.size(); i++)
System.out.println(list.get(i).getEntity());
有人可以给我一些指示。谢谢