Skip to content

Instantly share code, notes, and snippets.

@lyjia
Created October 18, 2022 01:51
Show Gist options
  • Save lyjia/ca59784543489d24294dab31886d65a7 to your computer and use it in GitHub Desktop.
Save lyjia/ca59784543489d24294dab31886d65a7 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# Converts a playlist exported from Rekordbox in "KUVO TXT" format to a more useful format of Artist - Title
# (C) 2022 Lyjia
require 'csv'
src = ARGV[0]
buf = ""
raise "Give me a file to process!" if src.nil?
raise "File '#{src}' does not exist!" unless File.exist?(src)
$stderr.puts "Processing #{src}..."
CSV.foreach(src, col_sep: "\t", headers: true, encoding: "UTF-16LE:UTF-8") do |row|
line = "#{row['Artist']} - #{row['Track Title']}\n"
puts line
buf << line
end
newname = src[0...-4] + " tracklist" + src[-4...]
$stderr.puts "Writing file to #{newname}"
File.write(newname, buf)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment