#!/usr/local/bin/ruby # Must have ruby later ruby to use Dir.children() require 'date' require 'shellwords' origin_folder = '~/Music/iTunes/iTunes Media/Podcasts/' Dir.chdir(File.expand_path(origin_folder)) contents = Dir.glob('*') contents.each {|folder| podcasts = Dir.children(folder) podcasts.each {|podcast| if File.expand_path(origin_folder + folder) == File.dirname(File.expand_path(origin_folder+folder+"/"+podcast)) if folder.downcase =~ /.*spanish.*/ else made_on = File.mtime(File.expand_path(origin_folder+folder+"/"+podcast)) if made_on.to_date == Time.now.to_date puts(podcast + " was made today and is getting converted") system("sox " + File.expand_path(origin_folder+folder+"/"+podcast).shellescape + " " + File.expand_path(origin_folder+folder+"/"+ "xfaster " + podcast).shellescape + " " + "tempo 1.25") system("mv " + File.expand_path(origin_folder + folder + "/" + "xfaster " + podcast).shellescape + " " + File.expand_path(origin_folder+folder+"/"+podcast).shellescape ) end end else puts("compared " + origin_folder + "/" + folder + " to " + File.dirname(File.expand_path(origin_folder+folder+"/"+podcast))) end } }