Will attempt to enqueue 40 songs from the top100 feed from MSN music. Untested but should work ok, might required some tweaks.

dim xmlhttp, art, dict1, mlq
Set xmlhttp = CreateObject("Msxml2.ServerXMLHTTP.4.0")
 
xmlhttp.Open "GET", "http://music.msn.com/services/rss.aspx?chartname=topsongs", false
xmlhttp.Send
set xmlDoc = CreateObject("Msxml2.DOMDocument.4.0")
 
res = xmlhttp.responsetext
 
'trim off the first character, which is causing a problem.
res = Right(res, Len(res)-1)
xmldoc.loadxml 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("channel")
set tl = nl.selectNodes("item")
 
Set Dict1 = CreateObject("Scripting.dictionary")
Dict1.CompareMode = 1
mlq = MediaLibrary.RunQueryArray("?")
	
i = 1
For each song in mlq
	dict1(song.title + " - " + song.artist) = i
	i = i + 1
Next
 
i = 0 
For each song in tl
		songtitle = song.selectSingleNode("title").text
		songtitle = Right(songtitle, Len(songtitle) - InStr(songtitle, "-"))
		songtitle = Trim(songtitle)
 
		idx = dict1(songtitle)				
		If idx>0 Then
			mlq(idx).enqueue
		Else
			LoadItem("x:\(missing) " + songtitle).enqueue
		End If
		
		i = i + 1
		If i > 40 Then
			Quit
		End If
Next
 
examples/webservice/msn_music_top100_songs_enqueue.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