Simple queue for youtube-dl in the Linux shell Simple queue for youtube-dl in the Linux shell shell shell

Simple queue for youtube-dl in the Linux shell


The tail -f will not work because the script reads all the input at once.

It will work if you modify the script to perform a continuous read of the batch file.

Then simply run the script as:

% ./youtube-dl -a batch.txt -c

When you append some data into batch.txt, say:

% echo "http://www.youtube.com/watch?v=j9SgDoypXcI" >>batch.txt

The script will start downloading the appended video to the batch.

This is the patch you should apply to the latest version of "youtube-dl":

2278,2286d2277<       while True:<           batchurls = batchfd.readlines()<           if not batchurls:<               time.sleep(1)<               continue<           batchurls = [x.strip() for x in batchurls]<           batchurls = [x for x in batchurls if len(x) > 0]<           for bb in batchurls:<               retcode = fd.download([bb])

Hope it helps,Happy video watching;)

NOTE: Due to code restructuring this patch will no longer work. Would be interested to see if this could be added to the upstream code.


You might be able to get away with using tail -f to read from your file. It will not exit when it reaches end-of-file but will wait for more data to be appended to the file.

>video.queue  # erase and/or create queue filetail -f video.queue | youtube-dl -a -

Since tail -f does not exit, youtube-dl should continue reading file names from stdin and never exit.