Class: Saber::Fetcher

Inherits:
Object
  • Object
show all
Defined in:
lib/saber/fetcher.rb

Instance Method Summary collapse

Instance Method Details

#add(*files) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/saber/fetcher.rb', line 17

def add(*files)
  files.each { |file|
    uri = "#{Rc.server.ftp}/#{file}"
    gid = aria2_add([uri], :dir => Pa.dir2("#{Rc.fetch.dir}/#{file}"))
    Saber.ui.debug "DOWNLOAD #{gid} #{uri}"
  }
end

#add_names(*names) ⇒ Object



7
8
9
10
# File 'lib/saber/fetcher.rb', line 7

def add_names(*names)
  files = retrive_files(*names)
  add(*files)
end

#aria2_add(uris, o = {}, &blk) ⇒ Object



12
13
14
15
# File 'lib/saber/fetcher.rb', line 12

def aria2_add(uris, o={}, &blk)
  @aria2 = XMLRPC::Client.new2(Rc.aria2.rpc)
  @aria2.call("aria2.addUri", uris, o, &blk)
end