Advertisement
kosx

This generates an opml file you can import into MusicBee's radio library.

Jan 30th, 2021
1,244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $doc = [xml]'<opml version="2.0"><body/></opml>'
  2. $body = $doc.selectSingleNode('//body')
  3.  
  4. # somafm.com channels..
  5. foreach($ch in (irm http://somafm.com/channels.xml).selectNodes('//channels/*')) {
  6.     $x = $doc.createElement('outline')
  7.     $x.setAttribute('text', "SomaFM - $($ch.title.innerText)")
  8.     $x.setAttribute('description', $ch.description.innerText)
  9.     $x.setAttribute('category', "$($ch.genre)/AAC/128k/")
  10.     $x.setAttribute('type', 'link')
  11.     $x.setAttribute('url', $ch.selectSingleNode('highestpls[@format="aac"]').innerText)
  12.     $body.appendChild($x)
  13. }
  14.  
  15. # di.fm channels..
  16. $listenkey = "xxxxxxxxxxxxxxxxxxxxxxxx"
  17. foreach($ch in (irm http://listen.di.fm/premium_high.json)) {
  18.     $x = $doc.createElement('outline')
  19.     $x.setAttribute('text', "Digitally Imported - $($ch.name)")
  20.     $x.setAttribute('category', "$($ch.key)/AAC/128k/")
  21.     $x.setAttribute('type', 'link')
  22.     $x.setAttribute('url', "$($ch.playlist)?$($listenkey)")
  23.     $body.appendChild($x)
  24. }
  25.  
  26. $w = new-object xml.xmlTextWriter("stations.xml", $null)
  27. $w.formatting = [xml.formatting]::indented
  28. $w.indentChar = "`t"
  29. $w.indentation = 1
  30. $doc.writeTo($w)
  31. $w.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement