class LyndaTranslatorSrt::SrtOriginal::Downloader

Constants

LYNDA_SRT_SERVICE_URL

Attributes

tmp_file_path[R]
url_course[R]

Public Class Methods

new(url_course) click to toggle source
# File lib/lynda_translator_srt/srt_original/downloader.rb, line 11
def initialize(url_course)
  @url_course = url_course
end

Public Instance Methods

download_zip_original_srt() click to toggle source
# File lib/lynda_translator_srt/srt_original/downloader.rb, line 15
def download_zip_original_srt
  load_link_zip_original_srt
  raise ArgumentError, "Unfortunately we doesn't load transcript to this course." if @link_original_srt.nil?

  tmp_file_name = "srt_original_at_"
  tmp_file = Tempfile.new(tmp_file_name)
  @tmp_file_path = tmp_file.path

  File.open(tmp_file.path, "wb") do |saved_file|
    # the following "open" is provided by open-uri
    open(@link_original_srt, "rb") do |read_file|
      saved_file.write(read_file.read)
    end
  end

  self
end

Private Instance Methods