Class: DasCatalog::Downloader

Inherits:
Object
  • Object
show all
Defined in:
lib/das_catalog/downloader.rb

Overview

TODO spec this

Class Method Summary collapse

Class Method Details

.process(screencast) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/das_catalog/downloader.rb', line 6

def self.process(screencast)
  # Mechanize was choking on large file downloads and keeps them in memory,
  # outsource to wget
  agent = DasCatalog.agent
  agent.redirect_ok = false
  result = agent.get screencast.download_link
  url = result.header["location"]
  url =~ /^http.+?([^\/]+\.mov)\?/
  output_filename = $1
  `wget --quiet #{Shellwords.escape url} -O #{DasCatalog.downloads_directory}/#{output_filename}`
end