Class: Astrobot::Controls
- Inherits:
-
Object
- Object
- Astrobot::Controls
- Defined in:
- lib/astrobot/controls.rb
Class Method Summary collapse
Class Method Details
.do(ids, action) ⇒ Object
3.1. Torrent Action Requests
Method name | libtransmission function
---------------------+-------------------------------------------------
"torrent-start" | tr_torrentStart
"torrent-start-now" | tr_torrentStartNow
"torrent-stop" | tr_torrentStop
"torrent-verify" | tr_torrentVerify
"torrent-reannounce" | tr_torrentManualUpdate ("ask tracker for more peers")
Request arguments: "ids", which specifies which torrents to use.
All torrents are used if the "ids" argument is omitted.
"ids" should be one of the following:
(1) an integer referring to a torrent id
(2) a list of torrent id numbers, sha1 hash strings, or both
(3) a string, "recently-active", for recently-active torrents
Response arguments: none
22 23 24 25 26 27 28 29 |
# File 'lib/astrobot/controls.rb', line 22 def self.do(ids, action) Logger.add "torrent-#{action.to_s} on #{ids}" ids = [ids] unless ids.class == Array ids = ids.map { |id| id.to_i } opts = { :ids => ids } response = Astrobot::Client.build("torrent-#{action.to_s}", opts) end |