Skip to content

Instantly share code, notes, and snippets.

@lexisother
Created October 22, 2022 14:22
Show Gist options
  • Save lexisother/6b8e4666a3495540d70b2e8ed9776cee to your computer and use it in GitHub Desktop.
Save lexisother/6b8e4666a3495540d70b2e8ed9776cee to your computer and use it in GitHub Desktop.
require "id3tag"
unless ARGV[0]
raise "No mp3 directory given!"
end
dir = ARGV[0]
unless dir.end_with? "/" then dir += "/" end
mp3s = Dir.glob(dir + "*.mp3")
mp3s.each do |file|
if file.split("/").last.match(/\d+\. .* - .*\.mp3/) then next end
ID3Tag.read(File.open(file, "rb")) do |tag|
puts "#{tag.track_nr}. #{tag.title} - #{tag.artist}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment