[Xfce4-commits] <eatmonkey:aria2-xml-rpc> Use aria2.remove for pause instead of the lowest-speed-limit hack
Mike Massonnet
noreply at xfce.org
Sun Jan 24 23:26:05 CET 2010
Updating branch refs/heads/aria2-xml-rpc
to e9fce19b4ca73c4ab61ee7031368da55e94eb0f7 (commit)
from c1807f97649db92ba7dbd0739e5ef58bfc3dbad9 (commit)
commit e9fce19b4ca73c4ab61ee7031368da55e94eb0f7
Author: Mike Massonnet <mmassonnet at xfce.org>
Date: Sun Jan 24 20:04:13 2010 +0100
Use aria2.remove for pause instead of the lowest-speed-limit hack
When a download is removed, the manager will leave it in the treeview,
e.g. it will only be removed from the treeview if the remove action was
done manually by pressing the remove button. Now the pause action calls
aria2.remove() and resume will start it again. This removes the hack
done with the lowest-speed-limit option.
src/eataria2.rb | 2 +-
src/eatmanager.rb | 30 ++++++++++--------------------
2 files changed, 11 insertions(+), 21 deletions(-)
diff --git a/src/eataria2.rb b/src/eataria2.rb
index 477d025..a20a055 100644
--- a/src/eataria2.rb
+++ b/src/eataria2.rb
@@ -106,7 +106,7 @@ class Eat::Aria2 < GLib::Object
# Launch aria2c process
command = "aria2c --disable-ipv6=true --enable-xml-rpc --xml-rpc-listen-port=#{@port} " \
"--conf-path=#{@confdir}/aria2.conf --log=#{@confdir}/aria2.log --log-level=notice " \
- "--dht-file-path=#{@confdir}/dht.dat --lowest-speed-limit=1K"
+ "--dht-file-path=#{@confdir}/dht.dat"
debug("start server", command)
@@pid = Process.spawn(command, :pgroup=>true, :chdir=>ENV['HOME'],
STDOUT=>"/dev/null", STDIN=>"/dev/null")
diff --git a/src/eatmanager.rb b/src/eatmanager.rb
index 94469f3..bdca1ad 100644
--- a/src/eatmanager.rb
+++ b/src/eatmanager.rb
@@ -149,7 +149,7 @@ class Eat::Manager
@liststore.set_value(row_iter, 9, File.basename(result[0]["path"]))
end
when "removed" then
- @liststore.remove(row_iter)
+ # TODO mark as stopped/inactive
when "error" then
@liststore.set_value(row_iter, 8, -1)
end
@@ -257,18 +257,9 @@ class Eat::Manager
end
def action_pause()
- # TODO stop the download and on resume start it again at position 0 to put
- # it in the front of the queue => drop the lowest-speed-limit hack
-
- # This is sorta a hack around aria2, the download speed limit
- # is drown under the lowest-speed-limit option and will thus be
- # stopped. After a short while it will render an error code 5
- # and will need to be restarted, cf. action_resume().
@treeview.selection.selected_each do |model, path, iter|
gid = iter.get_value(0)
- @aria2.change_options(gid.to_s,
- "max-download-limit" => "500",
- "max-upload-limit" => "500")
+ @aria2.remove(gid.to_s)
end
end
@@ -277,15 +268,14 @@ class Eat::Manager
gid = iter.get_value(0).to_s
status = @aria2.tell_status(gid)
case status["status"]
- when "active"
- @aria2.change_options(gid,
- "max-download-limit" => "0",
- "max-upload-limit" => "0")
- when "error"
- next if status["errorCode"] != "5"
- # Restart the download and delete current row as new gid will be created
- @aria2.add_uri(iter.get_value(10))
- @liststore.remove(iter)
+ when "removed"
+ # Restart the download queued at position 0 and delete current row
+ # as new gid will be created
+ uri = iter.get_value(10)
+ if !uri.empty?
+ @aria2.add_uri(uri, nil, 0)
+ @liststore.remove(iter)
+ end
end
end
end
More information about the Xfce4-commits
mailing list