Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env ruby
- Dir.chdir(File.dirname(__FILE__))
- # IPod-Shuffle-4g ignores aiff files and besides, they are really, really big.
- # (The originals are about 10 times bigger than the output mp3 after the conversion.)
- # 57M vs. 5,2M
- Dir.glob('**/*.aiff').each do |path|
- command = "ffmpeg -i '#{path}' '#{path.sub('.aiff', '.mp3')}' && rm '#{path}'"
- puts "~ #{command}"; system(command)
- end
- # The --rename-unicode option of ipod-shuffle-4g.py doesn't work.
- OK_FOLDERS = ['1 Lifeflow']
- Dir.glob('**/*.mp3').each do |path|
- next if OK_FOLDERS.include?(File.dirname(path))
- random = Array.new(8) { rand(256) }.pack('C*').unpack('H*').first
- extension = path.split('.').last.downcase
- new_path = [File.dirname(path), "#{random}.#{extension}"].join('/')
- unless path.match(/\/[\w\d]{16}\.mp3$/)
- puts "~ Renaming '#{path}' to '#{new_path}'."
- File.rename(path, new_path)
- end
- end
- options = %w{--track-gain 33 --auto-dir-playlists --verbose}
- system("IPod-Shuffle-4g/ipod-shuffle-4g.py --track-voiceover --rename-unicode #{options.join(' ')} .")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement