我知道 MusicBrainz 有可用的版本 2,但 v1 是我做到这一点的唯一方法。(这是 1 个返回,通常是数百个......): XML:
<metadata xmlns="http://musicbrainz.org/ns/mmd-1.0#" xmlns:ext="http://musicbrainz.org/ns/ext-1.0#">
<release-list count="928" offset="0">
<release id="bea5602c-53bc-4416-af49-238aae51e8ea" type="Live Bootleg" ext:score="100">
<title>Seattle 1988</title>
<text-representation language="ENG" script="Latn" />
<artist id="5b11f4ce-a62d-471e-81fc-a69a8278c7da">
<name>Nirvana</name>
<sort-name>Nirvana</sort-name>
</artist>
<release-event-list>
<event format="CD" />
</release-event-list>
<disc-list count="0" />
<track-list count="10" />
</release>
</release-list>
</metadata>
我可以通过以下方式返回所有专辑:
client = new WebClient();
client.OpenReadCompleted += client_OpenReadCompleted;
// Call public web service.
string requestUri =
"http://musicbrainz.org/ws/1/release/?limit=100&type=xml&artist={0}";
client.OpenReadAsync(
new Uri(String.Format(
requestUri, "Jimi Hendrix")));
private void client_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
{
// Process returned data.
XElement results;
albums = new List<string>();
if (e.Error != null)
{ return; }
else
{
XNamespace ns =
@"http://musicbrainz.org/ns/mmd-1.0#";
results = XElement.Load(e.Result);
var q = from r in results.Descendants(ns + "release")
select new { Title = r.Element(ns + "title").Value };
foreach (var i in q)
{
albums.Add(i.Title);
Console.WriteLine(i.Title);
}
}
我怎样才能获得每张专辑的发行ID?