Skip to content

Instantly share code, notes, and snippets.

@keating
Last active August 29, 2015 14:24
Show Gist options
  • Select an option

  • Save keating/68d2ab291908ebb9b2be to your computer and use it in GitHub Desktop.

Select an option

Save keating/68d2ab291908ebb9b2be to your computer and use it in GitHub Desktop.

Revisions

  1. keating renamed this gist Jul 7, 2015. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. keating created this gist Jul 7, 2015.
    23 changes: 23 additions & 0 deletions sort_englishpod
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    # 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