Skip to content

Instantly share code, notes, and snippets.

@drewbug
Created November 20, 2014 08:45

Revisions

  1. Drew Buglione created this gist Nov 20, 2014.
    17 changes: 17 additions & 0 deletions physics-dl.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    require 'timeout'

    loop do
    pid = fork

    if pid.nil?
    exec("youtube-dl https://www.youtube.com/playlist?list=PL47F408D36D4CF129")
    else
    begin
    Timeout::timeout(15 * 60) {
    Process.waitpid(pid, 0)
    }
    rescue Timeout::Error
    Process.kill("HUP", pid)
    end
    end
    end