Skip to content

Instantly share code, notes, and snippets.

@yigitbey
Created May 15, 2010 15:07
Show Gist options
  • Save yigitbey/402241 to your computer and use it in GitHub Desktop.
Save yigitbey/402241 to your computer and use it in GitHub Desktop.
#! /usr/bin/python
import sys
import os
import shutil
import random
os.system('find . -name \*.mp3 > input')
if os.path.isdir('output'):
shutil.rmtree('output')
os.mkdir('output')
songs = open('input').readlines()
for i in range(int(sys.argv[1])):
shutil.copy(songs[random.randrange(0,len(songs))].replace('\n',''),'output')
os.system('tar -jcvf output%i.tar.bz2 output/*'%(random.randrange(0,30)))
shutil.rmtree('output')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment