Page 1 of 1

Tunein Radio

Posted: Tue Mar 04, 2014 4:16 pm
by fizzjob
So I figured I'd take a crack at hacking together a Tunein Radio script - everything seems to be based on xml files (http://opml.radiotime.com/), but I'm having a hard time parsing them.

Here's what I've got so far - all it does is create a node in Net Radio, but I can't figure out how to populate the subnodes. Parsing XML just seems to elude me.

Code: Select all

Dim objXMLDoc
Dim NodeList 
Dim Node 
Dim ChildNode 
Dim NodeAttr 

Sub OnStartup
  Set Tree = SDB.MainTree
 
  Set Node = Tree.CreateNode
  Node.Caption = "Tunein Radio"
  Node.IconIndex = 56
  Node.UseScript = Script.ScriptPath
  Node.OnFillChildren = "FillGenres"
 
  Tree.AddNode Tree.Node_Radio, Node, 3     ' Insert after the node
  Node.HasChildren = True
End Sub

Sub FillGenres
	Set objXMLDoc = CreateObject("Microsoft.XMLDOM") 
	objXMLDoc.async = False 
	objXMLDoc.load("http://opml.radiotime.com")

	set Node = objXMLDoc.getElementsByTagName("outline")
	if Node.length > 0 then
		For each x in Node
			Set NewNode = Tree.CreateNode
			NewNode.Caption = x.getattribute("text")
			NewNode.IconIndex = 0
			Tree.AddNode Node, NewNode, 3
		next
	end if
End Sub
When I run this code with wscript, I get the "text" attributes, but I'm having a hard time getting it into MM.

Code: Select all

Dim objXMLDoc
Dim NodeList 
Dim Node 
Dim ChildNode 
Dim NodeAttr 

Set objXMLDoc = CreateObject("Microsoft.XMLDOM") 
objXMLDoc.async = False 
objXMLDoc.load("http://opml.radiotime.com")

set Node = objXMLDoc.getElementsByTagName("outline")
if Node.length > 0 then
	For each x in Node
		ChildNode = x.getattribute("text")
		WScript.echo ChildNode
	next
end if

Re: Tunein Radio

Posted: Fri May 30, 2014 9:11 pm
by Dan33185
Any update on this? Would love something like this for MM

Re: Tunein Radio

Posted: Sat May 31, 2014 9:43 am
by fizzjob
Nope. After a while, the XML files were coming up blank (even in my browser). I never could figure it out, although I figured that they were probably blocking my IP address.

Re: Tunein Radio

Posted: Sat May 31, 2014 7:44 pm
by Peke
On their site it is clearly stated that large number of requests could end in IP Ban.

I would suggest that you save XML locally and add Manual Refresh in Context menu.