Sha256: 13e8e4be60f0079ae712be97cb10090cf01d03de8072d73221647006e38f39af

Contents?: true

Size: 778 Bytes

Versions: 2

Compression:

Stored size: 778 Bytes

Contents

module Overscribe
  module YoutubeDL
    def self.download(url:, args:, options:)
      command = %w[youtube-dl --add-metadata]
      command += %w[--yes-playlist]
      command += %w[--ignore-errors --no-call-home]
      command += %w[--download-archive .youtube-dl.archive]

      command += %w[--get-filename] if options['simulate'] == true
      command += %W[--max-downloads #{options['limit']}] unless options['limit'].nil? || options['limit'].zero?
      command += %W[--output #{options['filename_pattern']}] unless options['filename_pattern'].nil?
      command += args

      command += [url]
      run command
    end

    def self.run(command)
      puts "Running '#{command}'"
      system(*command)
      status = $CHILD_STATUS
      puts status
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
overscribe-0.4.0 lib/overscribe/youtube_dl.rb
overscribe-0.3.1 lib/overscribe/youtube_dl.rb