No longer works - Audioscrobbler has become Last.FM and has a different layout. Also no longer valid XML.

' Enqueues the top songs for an artist as given by the artists
' statistics on Audioscrobbler.com
 
dim xmlhttp, art, dict1, mlq
 
x = playlist.getselection
 
if ubound(x) > 0 then
 
Set Dict1 = CreateObject("Scripting.dictionary")
Dict1.CompareMode = 1
art = x(1).artist
mlq = medialibrary.runqueryarray("artist = """ & art & """")
 
i = 1
for each song in mlq
 dict1(song.title) = i
 i = i + 1
next
 
set xmlhttp = CreateObject("Msxml2.ServerXMLHTTP.4.0")
 
xmlhttp.Open "GET", "http://www.audioscrobbler.com/music/" + art, false
xmlhttp.Send
set xmlDoc = CreateObject("Msxml2.DOMDocument.4.0")
 
res = xmlhttp.responsetext
xmldoc.validateonparse = false
xmldoc.resolveexternals = false
 
ns = "xmlns:asx='http://www.w3.org/1999/xhtml'"
xmldoc.setProperty "SelectionNamespaces", ns
 
xmldoc.loadxml replace(res, "&", " ")
 
If (xmlDoc.parseError.errorCode <> 0) Then
   Dim myErr
   Set myErr = xmlDoc.parseError
   MsgBox(myerr.reason + "  " + myErr.srctext)
   quit
end if
 
set nl = xmldoc.documentelement.selectSingleNode("asx:body/asx:div[@id='main']/asx:div[@class='content']/asx:table[@class='topn']")
set tl = nl.selectNodes("asx:tr")
 
for each song in tl
idx = dict1(song.selectSingleNode("asx:td/asx:a").text)
if (idx > 0) then
 mlq(idx).enqueue
end if
 
next
 
end if
quit
 
examples/webservice/audioscrobbler_integration.txt · Last modified: 2006/11/06 15:45
 
Recent changes RSS feed Creative Commons License Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki
Music Plugins