Advertisement
Guest User

Untitled

a guest
Jul 26th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. #!/usr/bin/env python
  2. import os, random, subprocess
  3.  
  4. """
  5. Place in a folder with music and/or subfolders containing music.
  6. Does not deal with non-music files except for .py files.
  7. Support for that is easy enough to add.
  8. Requires ffmpeg to be installed.
  9. """
  10.  
  11. songs = []
  12. for root, dirnames, filenames in os.walk(os.getcwd()):
  13. for filename in filenames:
  14. if not filename.lower().endswith(('.py')):
  15. songs.append(os.path.join(root, filename))
  16.  
  17. while True:
  18. subprocess.call(['ffplay', '-nodisp', '-autoexit', random.choice(songs)])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement