I'm running the following python script to play playlists in my Music library on my ras-pi.
import subprocess
import random
import sys
from os import listdir
files = []
for f in listdir("/home/pi/Music/" + sys.argv[1]):
files.append(f)
while len(files) > 0:
x = random.randint(0, len(files) - 1)
print x
var = files[x]
files.remove(var)
subprocess.call("omxplayer " + "/home/pi/Music/" + sys.argv[1] + "/" + var, shell=True)
I call the script using python shuffle.py <<<playlist>>>
.
I want to be able to run this command and still have access to the shell. Currently the shell prompt vanishes until every song has played.
I've tried adding an & to the subprocess call in the python script but that causes every song to play at once. I've also tried placing the & at the end of the command when I call it in the shell but this results in no music being played.