I can confirm this opens a VLC instance from Python, which I can control with the echo calls from the Terminal. Note that I added a 'break' line to the python script.
Terminal returns this:
stdout first echo call ready
('received', u'trying to enqueue /home/user/Documents/DualscreenVLC/videos/video01.mp4 to playlist\r\nenqueue: returned 0 (no error)\r\n')
So it seems to work.
The echo play | nc -U /home/luukschroder/Documents/Sockets/socket1.sock command after this hangs both when executed from Python and from the terminal.
Also in the activity monitor I can see multiple nc and sh, one for each call I made (vlc, echo enqueue and echo play).
Hopefully this clarifies it a bit.
import subprocess import socket import select esock, echildsock = socket.socketpair() osock, ochildsock = socket.socketpair() p = subprocess.Popen('vlc -I oldrc --rc-unix=/home/user/Documents/Sockets/socket1.sock', shell = True, stderr = echildsock.fileno(), stdout = ochildsock.fileno()) while p.poll() is None: r, w, x = select.select([esock, osock],[],[], 1.0) if not r: continue # timed out for s in r: print('stdout first echo call ready' if s is osock else 'stderr ready') data = s.recv(1024) print('received', data.decode('utf8')) breakWhen I run exactly the same command from Python but with: echo enqueue /home/user/Documents/DualscreenVLC/videos/video01.mp4
Terminal returns this:
stdout first echo call ready
('received', u'trying to enqueue /home/user/Documents/DualscreenVLC/videos/video01.mp4 to playlist\r\nenqueue: returned 0 (no error)\r\n')
So it seems to work.
The echo play | nc -U /home/luukschroder/Documents/Sockets/socket1.sock command after this hangs both when executed from Python and from the terminal.
Also in the activity monitor I can see multiple nc and sh, one for each call I made (vlc, echo enqueue and echo play).
Hopefully this clarifies it a bit.