Skip to content

Instantly share code, notes, and snippets.

@keating
Last active August 29, 2015 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save keating/68d2ab291908ebb9b2be to your computer and use it in GitHub Desktop.
Save keating/68d2ab291908ebb9b2be to your computer and use it in GitHub Desktop.
Change the track titles of EnglighPod mp3 files, so they are in the correct order in iTunes.
# use gem 'ruby-mp3info'
require "mp3info"
dir_root = "/Users/keating/Music/EnglishPod 1-50/"
d = Dir.new(dir_root)
flags = ('A'..'Z').to_a
d.each do |dir_name|
next if ['.', '..', '.DS_Store'].include?(dir_name)
if File.directory?(dir_root + dir_name)
dir = Dir.new(dir_root + dir_name)
i = 0
dir.each do |file_name|
if File.extname(file_name) == '.mp3'
path = "#{dir_root}/#{dir_name}/#{file_name}"
title = "englishpod_#{dir_name}_#{flags[i]}"
Mp3Info.open(path) do |mp3|
mp3.tag.title = title
end
i += 1
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment