public
Created

Quick and dirty script to get track names, artist names, and album names from an iTunes XML dump and output a CSV

  • Download Gist
itunes-xml-csv.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12
require 'csv'
 
track = /<key>Name<\/key><string>(.*)<\/string>[.\s]*<key>Artist<\/key><string>(.*)<\/string>[.\s]*<key>Album<\/key><string>(.*)<\/string>/
 
file = File.open("Library.xml", "r")
contents = file.read
 
out = CSV.open("Library.csv", "w")
 
contents.scan(track) do |match|
out << match
end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.