You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
583 B
20 lines
583 B
4 years ago
|
#This is a pretty weird script, it gets lines of text from somewhere
|
||
|
#And it makes a playlist, to keep the amount of tracks loosely connected
|
||
|
#To the amount of text.
|
||
|
import sys
|
||
|
from subprocess import Popen, PIPE
|
||
|
|
||
|
magic = sys.stdin.readlines()
|
||
|
lines = []
|
||
|
|
||
|
for line in magic:
|
||
|
lines.append(line)
|
||
|
|
||
|
pfind = Popen(["find", "/media/mp3" ], stdout=PIPE)
|
||
|
pgrep = Popen(["grep", "mp3"], stdin=pfind.stdout, stdout=PIPE)
|
||
|
pfind.stdout.close() # Allow pfind to receive a SIGPIPE if pgrep exits.
|
||
|
|
||
|
pshuf = Popen(["shuf", "-n {0}".format(len(lines))], stdin=pgrep.stdout)
|
||
|
pgrep.stdout.close()
|
||
|
|