Distant Constructs

VLC Queue



Queue for VLC

I often find that as I browse the internet, I have a list of many videos that I would like to watch, but I would only like to watch them one at a time. For example, when watching a YouTube video, there may be several recommended links that I would like to queue up. I was able to set this up using VLC, parallel[1], youtube-dl, xclip, and a named pipe, or fifo. This is nice because it works with any site supported by youtube-dl and because it allows VLC to be used for the playback (enabling options such as speeding up or slowing down the videos).

Steps

  1. Create a named pipe using the mkfifo) command (ie: mkfifo video. The following steps will assume that $VIDEO is the location of this fifo
  2. Start a process that reads the pipe using the following command tail -f $VIDEO | parallel -j1 'youtube-dl {} -i -o - | vlc --play-and-exit -'. This can be started at login by putting the command in ~/.xprofile, for example
  3. To queue up a video, copy its link to the clipboard and use a command like xclip -o >> $VIDEO && printf "\n" >> $VIDEO. This will cause the process from step 2 to pick up the url and play it through VLC. I have this command in an executable file on my path, which I invoke through dmenu (for which I have a global keybinding through xmonad)

Notes

[1] O. Tange (2011). GNU Parallel - The Command-Line Power Tool. ;login: The USENIX Magazine, 36, 42-47.


first published: 2016-02-03 0112 EST
last updated: 2017-09-29 0413 EDT