I am trying to use the Python 2.7 subprocess library to programmatically add songs to the VLC player queue.
From here and here, I am able to launch VLC Player and play a song (or queue songs from the outset);
from subprocess import Popen
vlcpath = r'C:\Program Files (x86)\VideoLAN\VLC\vlc.exe'
musicpath1 = r'path\to\song1.mp3'
musicpath2 = r'path\to\song2.mp3'
p = Popen([vlcpath,musicpath1]) # launch VLC and play song
p = Popen([vlcpath,musicpath1,musicpath2]) # launch VLC and play/queue songs
The problem is that I do not know the entire queue playlist at launch. I want to be able to add songs to the queue of the VLC process already running. How do I accomplish this, please?
From here, I think the appropriate command line entry is:
vlc.exe --started-from-file --playlist-enqueue "2.wmv"
But I do not know the syntax to execute this in subprocess. I tried a couple of things, but couldn't get either to work:
- calling Popen again (opens a new process)
- calling p.communicate (I thought this is how to enter stdin commands)