Created
October 18, 2022 01:51
-
-
Save lyjia/ca59784543489d24294dab31886d65a7 to your computer and use it in GitHub Desktop.
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
#!/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