Class: Grabber
- Inherits:
-
Object
- Object
- Grabber
- Defined in:
- lib/glued/grabber.rb
Instance Attribute Summary collapse
-
#urls ⇒ Object
readonly
Returns the value of attribute urls.
Instance Method Summary collapse
-
#initialize(manifest, bootstrap, io = nil) ⇒ Grabber
constructor
A new instance of Grabber.
Constructor Details
#initialize(manifest, bootstrap, io = nil) ⇒ Grabber
Returns a new instance of Grabber.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/glued/grabber.rb', line 6 def initialize(manifest, bootstrap, io=nil) raise "Only one segment can be handled" if bootstrap.segments != 1 #As we've hardcoded 1 below raise "Not enough fragments" if bootstrap.fragments < 1 raise "Too many fragments" if bootstrap.fragments > 10000 #not sure what this limit should be @uri = "#{manifest.media_filename}.flv" @url = "#{manifest.base_ref}/#{manifest.media_filename}Seg1-Frag" @total_fragments = bootstrap.fragments @urls = [] @downloaded_fragments = [] @fragments_downloaded = 0 #TODO: Track how much has already been downloaded and append from that point raise "Aborting as the download target file '#{@uri}' already exists" if File.exist? @uri @out = io ||= File.new(@uri, 'ab') @out.write(flv_header(1,1)) build end |
Instance Attribute Details
#urls ⇒ Object (readonly)
Returns the value of attribute urls.
4 5 6 |
# File 'lib/glued/grabber.rb', line 4 def urls @urls end |