Author Topic: Powershell script to import all stations from SomaFM and Digitally Imported  (Read 3433 times)


  • Newbie
  • *
  • Posts: 4
This generates an opml file you can import into MusicBee's radio library. If anyone knows other great sites that make their station lists relatively accessible, let me know and I'll add them. Or if you add it yourself post the patch to this gist.

$doc = [xml]'<opml version="2.0"><body/></opml>'
$body = $doc.selectSingleNode('//body')

# channels..
foreach($ch in (irm'//channels/*')) {
    $x = $doc.createElement('outline')
    $x.setAttribute('text', "SomaFM - $($ch.title.innerText)")
    $x.setAttribute('description', $ch.description.innerText)
    $x.setAttribute('category', "$($ch.genre)/AAC/128k/")
    $x.setAttribute('type', 'link')
    $x.setAttribute('url', $ch.selectSingleNode('highestpls[@format="aac"]').innerText)

# channels..
$listenkey = "xxxxxxxxxxxxxxxxxxxxxxxx"
foreach($ch in (irm {
    $x = $doc.createElement('outline')
    $x.setAttribute('text', "Digitally Imported - $($")
    $x.setAttribute('category', "$($ch.key)/AAC/128k/")
    $x.setAttribute('type', 'link')
    $x.setAttribute('url', "$($ch.playlist)?$($listenkey)")

$w = new-object xml.xmlTextWriter("stations.xml", $null)
$w.formatting = [xml.formatting]::indented
$w.indentChar = "`t"
$w.indentation = 1