Created
July 6, 2016 17:33
-
-
Save DrummerHead/eabe79469ecc44914fbab302c488b186 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env ruby | |
require 'shellwords' | |
wavs = Dir.glob("**/*.wav", File::FNM_CASEFOLD) | |
mp3s = Dir.glob("**/*.mp3", File::FNM_CASEFOLD) | |
puts "\n\n=================\n\n" | |
puts wavs | |
puts "\n\n=================\n\n" | |
p wavs | |
puts "\n\n=================\n\n" | |
def wav_to_mp3 paths | |
paths.each do |filepath| | |
name = (/^(.*?)\./.match(filepath) ? /^(.*?)\./.match(filepath)[1] : nil) | |
puts %x[ffmpeg -i #{Shellwords.escape filepath} -vn -ar 44100 -ac 2 -ab 192k -f mp3 #{Shellwords.escape name}.mp3] | |
puts "\n\n-----------\n\n" | |
end | |
end | |
def delete_files paths | |
paths.each do |filepath| | |
puts %x[rm #{Shellwords.escape filepath}] | |
end | |
end | |
wav_to_mp3 wavs | |
# delete_files wavs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment