uwa_download 0.1 → 0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/uwa_download/config.rb +1 -1
- data/lib/uwa_download/widget.rb +13 -9
- data/resources/script.js +3 -1
- metadata +2 -2
data/lib/uwa_download/config.rb
CHANGED
data/lib/uwa_download/widget.rb
CHANGED
@@ -16,23 +16,27 @@ class Download
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def download
|
19
|
-
start(
|
19
|
+
start(query['uri'].strip) if bin?
|
20
20
|
monitor
|
21
21
|
end
|
22
22
|
|
23
23
|
def monitor
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
t[:download]
|
28
|
-
|
29
|
-
|
30
|
-
]
|
31
|
-
end
|
24
|
+
if bin?
|
25
|
+
@threads.delete_if { |t| !t.status }
|
26
|
+
self << JSON.unparse(@threads.collect do |t|
|
27
|
+
t[:download].values_at(:name, :percent, :speed)
|
28
|
+
end)
|
29
|
+
else
|
30
|
+
self << JSON.unparse([["You have to install #{@bin.inspect} !"]])
|
31
|
+
end
|
32
32
|
end
|
33
33
|
|
34
34
|
private
|
35
35
|
|
36
|
+
def bin?
|
37
|
+
system("which #{@bin} > /dev/null 2>&1")
|
38
|
+
end
|
39
|
+
|
36
40
|
def start(uri)
|
37
41
|
FileUtils.mkdir_p @destination
|
38
42
|
@threads << Thread.start do
|
data/resources/script.js
CHANGED
@@ -30,7 +30,9 @@ widget.onMonitor = function(values) {
|
|
30
30
|
}
|
31
31
|
for (var i=0; i<values.length; i++) {
|
32
32
|
var li = widget.createElement('li');
|
33
|
-
li.appendText(values[i][0]
|
33
|
+
li.appendText(values[i][0]);
|
34
|
+
if (values[i][1]) li.appendText(' - ' + values[i][1] + '%');
|
35
|
+
if (values[i][2]) li.appendText(' - ' + values[i][2]);
|
34
36
|
widget.monitor.appendChild(li);
|
35
37
|
}
|
36
38
|
}
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
|
|
3
3
|
specification_version: 1
|
4
4
|
name: uwa_download
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: "0.
|
7
|
-
date: 2007-04-
|
6
|
+
version: "0.2"
|
7
|
+
date: 2007-04-12 00:00:00 +02:00
|
8
8
|
summary: UWA Download widget
|
9
9
|
require_paths:
|
10
10
|
- lib
|