Created
March 27, 2012 22:49
-
-
Save kylecronin/2221203 to your computer and use it in GitHub Desktop.
Quick and dirty script to get track names, artist names, and album names from an iTunes XML dump and output a CSV
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
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment