Class: CJOCHLSDownloader
- Inherits:
-
Object
- Object
- CJOCHLSDownloader
- Defined in:
- lib/JOCHLSDownloader.rb
Overview
CJOCHLSDownloader class downloads all HLS data from a URL
Instance Method Summary collapse
-
#initialize(url, path, logfile = nil, loglevel = Logger::INFO) ⇒ CJOCHLSDownloader
constructor
Initialize CJOCHLSDownloader.
-
#startdownload ⇒ Object
Start to donwload the HLS content.
Constructor Details
#initialize(url, path, logfile = nil, loglevel = Logger::INFO) ⇒ CJOCHLSDownloader
Initialize CJOCHLSDownloader
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/JOCHLSDownloader.rb', line 23 def initialize(url, path, logfile = nil, loglevel = Logger::INFO) @sourceurl = URI(url) @destpath = path #Start logger # Keep data for today and the past 3 days. @logger = nil if logfile != nil @logger = Logger.new(logfile) @logger.level = loglevel end end |
Instance Method Details
#startdownload ⇒ Object
Start to donwload the HLS content
38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/JOCHLSDownloader.rb', line 38 def startdownload () Log Logger::DEBUG, "Start download of #{@sourceurl} to #{@destpath}" #Get domain domain = @sourceurl.host url = @sourceurl.path port = @sourceurl.port Log Logger::DEBUG, "URI host: #{domain}, path: #{url}" downloadHLS domain, port, url, @destpath end |