Skip to content

Instantly share code, notes, and snippets.

@ajvargo
Created August 24, 2012 15:26
Show Gist options
  • Save ajvargo/3451979 to your computer and use it in GitHub Desktop.
Save ajvargo/3451979 to your computer and use it in GitHub Desktop.
Generate a randomly sorted m3u playlist
Dir.chdir '/Users/avargo/Music' do
File.open('../Downloads/all_random.m3u', 'w+') do |file|
Dir.glob('**/*.{mp3,ogg,wav}').shuffle.each do |song|
next if File.directory?(file)
file.write File.join(Dir.pwd, song, "\n")
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment