I've seen several posts asking for MusicBee to output radio stations in M3U format instead of OPML (XML). I also wanted that, so I wrote a converter in AutoHotKey (see below). It will input an OPML file (*.xml) from MusicBee and output an M3U for use in other applications. I tested it by importing the M3U file into MusicBee as a playlist and it worked as expected. You need AutoHotKey V1 to run this. It won't run under version 2 (although I hear there are converters available).
; This routine will read the radio stations from an OPML (XML) file exported
; by MusicBee, and will create an M3U playlist for import to other applications.
; User is prompted for the name of the OPML file, a name for the created M3U
; file, and a name for the overall playlist (how it will be shown in the target
; application).
#SingleInstance, Force ; Only allow one running instance of script at one time
; Select the input OPML file created by MusicBee
FileSelectFile, SelectedInput, , *.xml, Select a MusicBee OPML file for input, *.xml
; Specify the output M3U file. If it exists, overwrite it
FileSelectFile, SelectedOutput, S, *.m3u, Select an M3U for output, *.m3u
FileDelete, %SelectedOutput%
; Get a name for the M3U playlist (may be different than output filename)
Gui, New, -MaximizeBox -MinimizeBox
Gui, Add, Text,, Name for Playlist:
Gui, Add, Edit, vPlayName
Gui, Add, Button, gOK, OK
Gui, Show,, Playlist Name
return
OK:
Gui, Submit
; Read the OPML (XML) file:
FileRead, XMLData, %SelectedInput% ; Read XML file
; Create the M3U output file:
FileAppend, #EXTM3U`r`n#PLAYLIST:%PlayName%`r`n, %SelectedOutput%
; Parse XML file for specific tag values and write them to M3U
start := 1
while (pos1 := RegExMatch(XMLData, "<outline text=\""(.+?)\""", name, start))
{
pos2 := RegExMatch(XMLData, "description=\""(.+?)\""", descr, start)
pos3 := RegExMatch(XMLData, "category=\""(.+?)\""", categ, start)
pos4 := RegExMatch(XMLData, "url=\""(.+?)\""", url, start)
FileAppend, #EXTINF:-1`,%name1%`r`n, %SelectedOutput%
FileAppend, %url1%`r`n, %SelectedOutput%
start := pos4 + 1
}
return