Last active
August 29, 2015 14:24
-
-
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.
This file contains hidden or 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
# 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