Last active
November 21, 2018 00:31
-
-
Save RamonRomeroQro/9a9e90590a3268312b470f97a3748458 to your computer and use it in GitHub Desktop.
Revisions
-
RamonRomeroQro revised this gist
Nov 21, 2018 . 1 changed file with 10 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -30,10 +30,17 @@ def playthread(filedir): def stop(): p = subprocess.Popen(['ps', '-A'], stdout=subprocess.PIPE) out, err = p.communicate() a=[] for i in out: a.append(chr(i)) a.split('\n') a="".join(a) a=a.split('\n') for line in a: if 'omxplayer' in line: line=line.split() pid = int(line[0]) os.kill(pid, signal.SIGKILL) if __name__ == '__main__': -
RamonRomeroQro revised this gist
Nov 21, 2018 . 1 changed file with 4 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -21,14 +21,16 @@ def playsound (filedir): subprocess.call(['omxplayer', filedir]) def playthread(filedir): p = multiprocessing.Process(target=playsound, args=(filedir,)) p.start() p.join() def stop(): p = subprocess.Popen(['ps', '-A'], stdout=subprocess.PIPE) out, err = p.communicate() out.decode('UTF-8') for line in out.splitlines(): if 'omxplayer' in line: pid = int(line.split(None, 1)[0]) -
RamonRomeroQro revised this gist
Nov 20, 2018 . 1 changed file with 8 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -15,11 +15,17 @@ import subprocess, signal, time # multiprocessing_simple.py import multiprocessing def playsound (filedir): subprocess.call(['omxplayer', filedir]) def multithread(filedir): p = multiprocessing.Process(target=playsound, args=(filedir)) p.start() p.join() def stop(): p = subprocess.Popen(['ps', '-A'], stdout=subprocess.PIPE) out, err = p.communicate() -
RamonRomeroQro revised this gist
Nov 20, 2018 . 1 changed file with 13 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -12,13 +12,25 @@ ''' import subprocess, signal, time def playsound (filedir): #llamada a modulo omxplayer subprocess.call(['omxplayer', filedir]) def stop(): p = subprocess.Popen(['ps', '-A'], stdout=subprocess.PIPE) out, err = p.communicate() for line in out.splitlines(): if 'omxplayer' in line: pid = int(line.split(None, 1)[0]) os.kill(pid, signal.SIGKILL) if __name__ == '__main__': #playsound (filedir) #time.sleep(5) #stop() -
RamonRomeroQro created this gist
Nov 15, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ ''' @Krotolamo Reproducir sonido, recibe como parametro la ubicacion de archivo Deberia correr sin problemas porque el paquete ya vien instalado en la RBP, pero si no, estos son los comandos de instalacion $ sudo apt update $ sudo apt install omxplayer ''' import subprocess def playsound (filedir): #llamada a modulo omxplayer subprocess.call(['omxplayer', filedir]) if __name__ == '__main__': #playsound (filedir)