Class: UWA::Widget::Download
- Inherits:
-
Handler
- Object
- Handler
- UWA::Widget::Download
- Defined in:
- lib/uwa_download/config.rb,
lib/uwa_download/widget.rb
Constant Summary collapse
- NAME =
'uwa_download'
- VERSION =
'0.2'
- COPYRIGHT =
'Copyright (C) 2007 Florent Solt'
- DESC =
'UWA Download widget'
- AUTHOR =
'Florent Solt'
- EMAIL =
'[email protected]'
- HOMEPAGE =
'http://gnetvibes.rubyforge.org'
- LICENSE =
'BSD'
Instance Method Summary collapse
- #download ⇒ Object
-
#initialize ⇒ Download
constructor
A new instance of Download.
- #monitor ⇒ Object
Constructor Details
#initialize ⇒ Download
Returns a new instance of Download.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/uwa_download/widget.rb', line 7 def initialize super @author = AUTHOR @title = 'Download' @threads = [] @destination = "/tmp/download" @icon = "http://www.netvibes.com/img/icons/world.gif" @bin = '/usr/bin/aria2c' @args = '--allow-overwrite=true --log=/dev/null --listen-port=42066 --max-upload-limit=20K' end |
Instance Method Details
#download ⇒ Object
18 19 20 21 |
# File 'lib/uwa_download/widget.rb', line 18 def download start(query['uri'].strip) if bin? monitor end |
#monitor ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/uwa_download/widget.rb', line 23 def monitor if bin? @threads.delete_if { |t| !t.status } self << JSON.unparse(@threads.collect do |t| t[:download].values_at(:name, :percent, :speed) end) else self << JSON.unparse([["You have to install #{@bin.inspect} !"]]) end end |