Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import os, random, subprocess
- """
- Place in a folder with music and/or subfolders containing music.
- Does not deal with non-music files except for .py files.
- Support for that is easy enough to add.
- Requires ffmpeg to be installed.
- """
- songs = []
- for root, dirnames, filenames in os.walk(os.getcwd()):
- for filename in filenames:
- if not filename.lower().endswith(('.py')):
- songs.append(os.path.join(root, filename))
- while True:
- subprocess.call(['ffplay', '-nodisp', '-autoexit', random.choice(songs)])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement