| 1 | [[libtorrentMirror]] |
| 2 | |
| 3 | = Commands = |
| 4 | |
| 5 | This is a list of commands supported by rtorrent. Under each command, its parameters are listed, where '''Bold''' means it is required and ''italic'' that it is optional. Commands that are ''italic'' are nor available through XMLRPC. |
| 6 | |
| 7 | See [wiki:RTorrentCommandsRaw] for a complete list. |
| 8 | |
| 9 | |
| 10 | = System = |
| 11 | |
| 12 | |
| 13 | === system.listMethods === |
| 14 | |
| 15 | Returns a list of all available commands. |
| 16 | |
| 17 | |
| 18 | === system.client_version === |
| 19 | === system.library_version === |
| 20 | |
| 21 | Returns the client or library version. |
| 22 | |
| 23 | |
| 24 | === system.pid === |
| 25 | |
| 26 | Returns the process id. |
| 27 | |
| 28 | |
| 29 | === system.hostname === |
| 30 | |
| 31 | Returns the hostname. |
| 32 | |
| 33 | |
| 34 | === system.get_cwd === |
| 35 | === system.set_cwd, ''cwd'' = directory === |
| 36 | |
| 37 | Change the current working directory using the ''chdir'' system call. |
| 38 | |
| 39 | |
| 40 | === system.set_umask = numask === |
| 41 | |
| 42 | Set the process's file mode creation mask to ''numask'' through the |
| 43 | ''umask'' system call. |
| 44 | |
| 45 | |
| 46 | = Generic = |
| 47 | |
| 48 | |
| 49 | === download_list = ''view'' === |
| 50 | |
| 51 | ''view'':: |
| 52 | Select the view to use. An empty string equals "default". |
| 53 | |
| 54 | Returns a list of the info-hashes of downloads in ''view', encoded in capital letter hexadecimal. |
| 55 | |
| 56 | |
| 57 | === execute_log = ''log_file'' === |
| 58 | |
| 59 | Log the output of commands called by "execute" to ''log_file''. If no |
| 60 | parameter is passed, then logging is disabled. |
| 61 | |
| 62 | |
| 63 | === load, load_verbose, load_raw, load_raw_start, load_raw_verbose, load_start, load_start_verbose = [uri|file|data], ... === |
| 64 | |
| 65 | [uri|file|data]:: |
| 66 | A string either representing an URI, file path including '*' as |
| 67 | wildcards, or raw torrent data. |
| 68 | |
| 69 | ...:: |
| 70 | Any number of download commands to be called upon successful creation |
| 71 | of the torrent. These will be called before the torrent is started. |
| 72 | |
| 73 | Load a torrent and call download commands once done. Creation of the |
| 74 | torrent is done lazily, thus no download is created during this call. |
| 75 | |
| 76 | * ''verbose'' Print error messages to the log. |
| 77 | * ''raw'' The argument passed is the raw torrent data to be loaded. |
| 78 | * ''start'' Start the torrent. |
| 79 | |
| 80 | |
| 81 | === close_on_ratio = min_ratio, ''min_upload'', ''max_ratio'', ... === |
| 82 | === stop_on_ratio = min_ratio, ''min_upload'', ''max_ratio'', ... === |
| 83 | |
| 84 | ...:: |
| 85 | Any number of commands to be executed on the stopped/closed torrent. |
| 86 | |
| 87 | For rTorrent 0.8.4 please see [wiki:RTorrentRatioHandling]. |
| 88 | |
| 89 | For versions before 0.8.4: |
| 90 | |
| 91 | Stop/Close torrents when they reach the given upload ratio |
| 92 | ''min_ratio'' in percent. If the optional ''min_upload'' is given, |
| 93 | require a total upload amount of this many bytes as well. If the |
| 94 | optional ''max_ratio'' is given, stop the torrent when reaching this |
| 95 | ratio regardless of the total upload amount. Exclude certain torrent |
| 96 | by pressing ''Shift+I'' in the downlist list. Intended for use with |
| 97 | the ''schedule'' option. |
| 98 | |
| 99 | {{{ |
| 100 | stop_on_ratio = 100, 20M, 300, d.erase= |
| 101 | }}} |
| 102 | |
| 103 | |
| 104 | |
| 105 | |
| 106 | |
| 107 | === get_check_hash === |
| 108 | === set_check_hash, ''check_hash'' = true === |
| 109 | |
| 110 | Perform hash check on torrents that have finished downloading. |
| 111 | |
| 112 | |
| 113 | === get_directory === |
| 114 | === set_directory, ''directory'' = "./" === |
| 115 | |
| 116 | Set the default download directory for newly loaded torrents. |
| 117 | |
| 118 | |
| 119 | === get_name === |
| 120 | === set_name = "session name" === |
| 121 | |
| 122 | Name of this rtorrent session, for display in the main title or XMLRPC |
| 123 | clients. |
| 124 | |
| 125 | |
| 126 | === get_session === |
| 127 | === set_session, ''session'' = "" === |
| 128 | |
| 129 | Session management will be enabled and the torrent files for all open |
| 130 | downloads will be stored in this directory. Only one instance of |
| 131 | rtorrent can be used per session directory. An empty string will |
| 132 | disable the session directory. |
| 133 | |
| 134 | |
| 135 | |
| 136 | = Network = |
| 137 | |
| 138 | |
| 139 | === encryption = ... === |
| 140 | |
| 141 | Set how rtorrent should deal with encrypted Bittorrent connections. By |
| 142 | default, encryption is disabled, equivalent to specifying the option |
| 143 | ''none''. Alternatively, any number of the following options may be |
| 144 | specified: |
| 145 | |
| 146 | * ''allow_incoming'' (allow incoming encrypted connections) |
| 147 | * ''try_outgoing'' (use encryption for outgoing connections) |
| 148 | * ''require'' (disable unencrypted handshakes) |
| 149 | * ''require_RC4'' (also disable plaintext transmission after the initial encrypted handshake) |
| 150 | * ''enable_retry'' (if the initial outgoing connection fails, retry with encryption turned on if it was off or off if it was on) |
| 151 | * ''prefer_plaintext'' (choose plaintext when peer offers a choice between plaintext transmission and RC4 encryption, otherwise RC4 will be used) |
| 152 | |
| 153 | |
| 154 | === get_bind === |
| 155 | === set_bind, ''bind'' = ["0.0.0.0"|"example.com"] === |
| 156 | |
| 157 | Bind listening socket and outgoing connections to this network |
| 158 | interface address. |
| 159 | |
| 160 | |
| 161 | === get_http_proxy === |
| 162 | === set_http_proxy, http_proxy = "!http://example.com" === |
| 163 | |
| 164 | Use a http proxy. Disable with an empty string. |
| 165 | |
| 166 | |
| 167 | === get_ip === |
| 168 | === set_ip, ''ip'' = ["0.0.0.0"|"example.com"] === |
| 169 | |
| 170 | Set the address reported to the tracker. |
| 171 | |
| 172 | |
| 173 | === get_random_open === |
| 174 | === set_random_open, ''port_random'' = true === |
| 175 | |
| 176 | If set, when opening the listening port a random port in |
| 177 | ''port_range'' will be selected. Else the lowest available in the |
| 178 | range will be used. |
| 179 | |
| 180 | |
| 181 | === get_port_range === |
| 182 | === set_port_range, ''port_range'' = range === |
| 183 | |
| 184 | '''range''' = "6881-6999":: |
| 185 | Port numbers in the range <0,2^16^>, as a string. |
| 186 | |
| 187 | Set the port range that may be used for the listening port. |
| 188 | |
| 189 | |
| 190 | |
| 191 | = User-Interface = |
| 192 | |
| 193 | |
| 194 | === view_add = name === |
| 195 | |
| 196 | Create a new view. |
| 197 | |
| 198 | |
| 199 | === view_sort = name === |
| 200 | === view_sort = name,seconds === |
| 201 | |
| 202 | Sort a view according the the criteria set by view_sort_current. If |
| 203 | the optional argument is supplied, the view is not sorted if a change |
| 204 | happened during the last ''n'' seconds. This command is meant to be used |
| 205 | with schedule. |
| 206 | |
| 207 | |
| 208 | === view_filter = name,command === |
| 209 | |
| 210 | Set the command to be used when filtering downloads. The command should return a value, where non-zero values indicates the download should be in the list. An empty ''command'' results in no filtering being done. |
| 211 | |
| 212 | {{{ |
| 213 | // d.get_state is 0 for stopped torrents, 1 for started. |
| 214 | view_filter = stopped,not=$d.get_state= |
| 215 | |
| 216 | view_filter = seeding,"and=d.get_state=,d.get_complete=" |
| 217 | }}} |
| 218 | |
| 219 | |
| 220 | === view_filter_on = ... === |
| 221 | |
| 222 | ... |
| 223 | |
| 224 | |
| 225 | === view_sort_new = name,command === |
| 226 | === view_sort_current = name,command === |
| 227 | |
| 228 | Same as ''view_filter'', except it requires commands that take two download targets. This takes the C++ STL requirements on sorting operators, so the operator must use strict weak ordering (e.g. ''less than'', not ''less or equal to'') and non-zero results are ordered first. |
| 229 | |
| 230 | {{{ |
| 231 | view_sort_new = started,less=d.get_name= |
| 232 | }}} |
| 233 | |
| 234 | |
| 235 | === get_key_layout === |
| 236 | === set_key_layout, ''key_layout'' = [qwerty|azerty|qwertz|dvorak] === |
| 237 | |
| 238 | Change the key-bindings. |
| 239 | |
| 240 | |
| 241 | |
| 242 | = Tools = |
| 243 | |
| 244 | Various commands useful for scripting. |
| 245 | |
| 246 | |
| 247 | === cat = ... === |
| 248 | |
| 249 | Concatenate any number of object as a string. |
| 250 | |
| 251 | {{{ |
| 252 | # Sets the base directory to '~/download/<info_hash>'. |
| 253 | d.set_directory_base = $cat=~/download/\,$d.get_hash= |
| 254 | }}} |
| 255 | |
| 256 | |
| 257 | === if = ... === |
| 258 | === branch = ... === |
| 259 | |
| 260 | A series of if/else statements. Every even arguments are conditionals |
| 261 | and odd arguments are branches to be executed, except the last one |
| 262 | which is always a branch. |
| 263 | |
| 264 | The branch is returned by the 'if; command unless it is a string |
| 265 | starting with an '$', in which case the branch is executed and the |
| 266 | result returned. |
| 267 | |
| 268 | To work around certain limitations in the current parsing code, a |
| 269 | 'branch' command was added that executes all strings as commands thus |
| 270 | not needing a '$'. |
| 271 | |
| 272 | {{{ |
| 273 | if (cond1) { branch1 } |
| 274 | <cond1>,<branch1> |
| 275 | |
| 276 | if (cond1) { branch1 } else if (cond2) { branch2 } else { branch3 } |
| 277 | <cond1>,<branch1>,<cond2>,<branch2>,<branch3> |
| 278 | |
| 279 | on_start = test1,"if=$d.get_custom1=,\\$d.set_custom2=$d.get_custom1=,\\$d.set_custom2=foo" |
| 280 | }}} |
| 281 | |
| 282 | = Download = |
| 283 | |
| 284 | All download commands except d.multicall take the info-hash of the |
| 285 | target download, encoded in capital letter hexadecimal, as the first |
| 286 | argument. |
| 287 | |
| 288 | |
| 289 | === d.multicall, ~~call_download~~ = view, ... === |
| 290 | |
| 291 | '''view''':: |
| 292 | Select the view to use. An empty string equals "default". |
| 293 | |
| 294 | ...:: |
| 295 | Any number of download commands. Each command must contain '=', with optional arguments. |
| 296 | |
| 297 | Returns a list of lists, where each element is a list of result from calls on one download. |
| 298 | |
| 299 | {{{ |
| 300 | > xmlrpc localhost d.multicall "started" "d.get_name=" "d.get_size_chunks=" |
| 301 | Array of 2 items: |
| 302 | Index 0 Array of 2 items: |
| 303 | Index 0 String: 'Forget-me-not c001.zip' |
| 304 | Index 1 Integer: 26 |
| 305 | Index 1 Array of 2 items: |
| 306 | Index 0 String: 'Forget-me-not c002.zip' |
| 307 | Index 1 Integer: 17 |
| 308 | }}} |
| 309 | |
| 310 | |
| 311 | === d.update_priorities === |
| 312 | |
| 313 | Put any changes to file priorities into effect. This command is |
| 314 | relatively expensive and should therefor be called after a batch of |
| 315 | changes to priorities has been done. |
| 316 | |
| 317 | === d.add_peer(String hash, String peer) === |
| 318 | Adds a known peer to the torrent. The peer should be specified as |
| 319 | IP:PORT. If the port is not sent in this parameter, rTorrent sets it by |
| 320 | default to 6881. |
| 321 | |
| 322 | '''@param hash''':: The hash which identifies the torrent |
| 323 | '''@param peer''':: The peer to be added of the form IP:PORT |
| 324 | '''@return''':: An int marking the result (0 means okay) |
| 325 | |
| 326 | === d.check_hash(String hash) === |
| 327 | Checks the hash of a torrent. |
| 328 | |
| 329 | '''@param hash''':: The hash which identifies the torrent |
| 330 | '''@return''':: An int marking the result (0 means okay) |
| 331 | |
| 332 | === d.close(String hash) === |
| 333 | Closes a torrent and closes all its connections too. |
| 334 | |
| 335 | '''@param hash''':: The hash which identifies the torrent |
| 336 | '''@return''':: An int marking the result (0 means okay) |
| 337 | |
| 338 | === d.create_link(String hash, String type, String path, String suffix) === |
| 339 | Creates a symbolic link. The link path is the concatenation of path, the |
| 340 | result of the type on the download and suffix. |
| 341 | Available types are: |
| 342 | * base_path uses the base path of the download for creating the link; if base_path is specified, then supplying the path parameter cancels the operation |
| 343 | * base_filename uses the base filename of the download for the link and the path provided by path |
| 344 | * tied uses the path of the .torrent file to which the download is tied for the operation |
| 345 | |
| 346 | '''@param hash''':: The hash which identifies the torrent |
| 347 | '''@param type''':: The type described as above |
| 348 | '''@param path''':: The path of the link |
| 349 | '''@param suffix''':: The suffix to be added for the link |
| 350 | '''@return''':: An int marking the result (0 means okay) |
| 351 | |
| 352 | = File = |
| 353 | |
| 354 | All file commands take the info-hash of the target download, encoded |
| 355 | in capital letter hexadecimal, as the first argument and the index of |
| 356 | the file as the second. |
| 357 | |
| 358 | |
| 359 | = Peer Connection = |
| 360 | |
| 361 | === p.multicall = info_hash, dummy_argument, ... === |
| 362 | |
| 363 | See "d.multicall". |
| 364 | |
| 365 | |
| 366 | = Tracker = |
| 367 | |
| 368 | === t.multicall = info_hash, dummy_argument, ... === |
| 369 | |
| 370 | See "d.multicall". |
| 371 | |
| 372 | === t.get_group === |
| 373 | === t.get_id === |
| 374 | === t.get_type === |
| 375 | === t.get_url === |
| 376 | |
| 377 | === t.get_min_interval === |
| 378 | === t.get_normal_interval === |
| 379 | |
| 380 | === t.get_scrape_complete === |
| 381 | === t.get_scrape_downloaded === |
| 382 | === t.get_scrape_incomplete === |
| 383 | === t.get_scrape_time_last === |
| 384 | |
| 385 | === t.is_enabled === |
| 386 | === t.set_enabled = [true|false] === |
| 387 | === t.is_open === |