There didn’t seem to be a way to do this on OSX / Mac so I thought I’d write a quick script. I have a lot of playlists in Traktor that I’d like to use else where, for instance on my phone and in VLC. The trouble is, NML is a proprietary format to Traktor. Luckily, it’s XML based and the M3U format is incredibly simple (just a list of file paths). So:
# Convert Traktor NML playlists to M3U
f = File.open(ARGV)
@doc = Nokogiri::XML(f)
m3u = File.new(ARGV+".m3u", "w+")
@doc.xpath("//LOCATION").each do |location|
volume = location.xpath("@VOLUME").to_s
dir = location.xpath("@DIR").to_s
file = location.xpath("@FILE").to_s
Voila! Make sure you have the nokogiri gem installed – we need this to handle the XML. Save the above script somewhere, make it executable with chmod o+x nml_to_m3u.rb then run it with your NML file as an argument:
It’ll write an M3U playlist to a new file in the same folder.
Note: If you’re making these playlists for another device, you may need to alter the paths a bit. M3U can take relative paths, so if you’d exported your Traktor collection to another folder, you could just change the output line to:
and drop the resulting file in with all your exported MP3s. Hope that helps someone somewhere!