Created
January 29, 2017 03:29
-
-
Save gfody/3e869791c86e4f1e31bcd85eb9d2bab5 to your computer and use it in GitHub Desktop.
Import Digitally Imported and SomaFM radio stations into MusicBee
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$doc = [xml]'<opml version="2.0"><body/></opml>' | |
$body = $doc.selectSingleNode('//body') | |
# somafm.com channels.. | |
foreach($ch in (irm http://somafm.com/channels.xml).selectNodes('//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) | |
$body.appendChild($x) | |
} | |
# di.fm channels.. | |
$listenkey = "xxxxxxxxxxxxxxxxxxxxxxxx" | |
foreach($ch in (irm http://listen.di.fm/premium_high.json)) { | |
$x = $doc.createElement('outline') | |
$x.setAttribute('text', "Digitally Imported - $($ch.name)") | |
$x.setAttribute('category', "$($ch.key)/AAC/128k/") | |
$x.setAttribute('type', 'link') | |
$x.setAttribute('url', "$($ch.playlist)?$($listenkey)") | |
$body.appendChild($x) | |
} | |
$w = new-object xml.xmlTextWriter("stations.xml", $null) | |
$w.formatting = [xml.formatting]::indented | |
$w.indentChar = "`t" | |
$w.indentation = 1 | |
$doc.writeTo($w) | |
$w.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Generates an OPML file with all the soma and di stations for easy import into MusicBee. Script generates stations.xml, e.g.:
(xxxxxxxxxxxxxxxxxxxxxxxx is not a valid di listen key)