Class: Deluge
- Inherits:
-
Object
- Object
- Deluge
- Defined in:
- lib/deluge.rb,
lib/deluge/protocol/v3.rb
Instance Method Summary collapse
-
#add_torrent_file(filename, filedump, options = {}) ⇒ Object
Available options: max_connections max_upload_slots max_upload_speed max_download_speed prioritize_first_last_pieces file_priorities compact_allocation download_location auto_managed stop_at_ratio stop_ratio remove_at_ratio move_completed move_completed_path add_paused.
-
#add_torrent_magnet(uri, options = {}) ⇒ Object
Available options: max_connections max_upload_slots max_upload_speed max_download_speed prioritize_first_last_pieces file_priorities compact_allocation download_location auto_managed stop_at_ratio stop_ratio remove_at_ratio move_completed move_completed_path add_paused.
-
#add_torrent_url(url, options = {}) ⇒ Object
Available options: max_connections max_upload_slots max_upload_speed max_download_speed prioritize_first_last_pieces file_priorities compact_allocation download_location auto_managed stop_at_ratio stop_ratio remove_at_ratio move_completed move_completed_path add_paused.
- #call(*args) ⇒ Object
- #connect_peer(torrent_id, ip, port) ⇒ Object
- #create_torrent(path, tracker, piece_length, comment, target, webseeds, privat, created_by, trackers, add_to_session) ⇒ Object
- #disable_plugin(plugin) ⇒ Object
- #enable_plugin(plugin) ⇒ Object
- #force_reannounce(*torrent_ids) ⇒ Object
- #force_recheck(*torrent_ids) ⇒ Object
- #get_available_plugins ⇒ Object
- #get_cache_status ⇒ Object
- #get_config ⇒ Object
- #get_config_values(*keys) ⇒ Object
- #get_enabled_plugins ⇒ Object
- #get_filter_tree(show_zero_hits = true, hide_cat = nil) ⇒ Object
- #get_free_space(path = nil) ⇒ Object
- #get_libtorrent_version ⇒ Object
- #get_listen_port ⇒ Object
- #get_method_list ⇒ Object
- #get_num_connections ⇒ Object
- #get_path_size(path) ⇒ Object
- #get_session_state ⇒ Object
- #get_session_status(keys) ⇒ Object
- #get_torrent_status(torrent_id, keys, diff = false) ⇒ Object
- #glob(path) ⇒ Object
- #info ⇒ Object
-
#initialize(host = 'localhost', port = '58846', protocol = 3) ⇒ Deluge
constructor
A new instance of Deluge.
- #login(username, password) ⇒ Object
- #move_storage(*torrent_ids, dest) ⇒ Object
- #pause_all_torrents ⇒ Object
- #pause_torrent(*torrent_ids) ⇒ Object
- #queue_bottom(*torrent_ids) ⇒ Object
- #queue_down(*torrent_ids) ⇒ Object
- #queue_top(*torrent_ids) ⇒ Object
- #queue_up(*torrent_ids) ⇒ Object
- #remove_torrent(torrent_id, remove_data: false) ⇒ Object
- #rename_files(torrent_id, filenames) ⇒ Object
- #rename_folder(torrent_id, folder, new_folder) ⇒ Object
- #rescan_plugins ⇒ Object
- #resume_all_torrents ⇒ Object
- #resume_torrent(*torrent_ids) ⇒ Object
- #set_config(config) ⇒ Object
- #set_torrent_auto_managed(torrent_id, value) ⇒ Object
- #set_torrent_file_priorities(torrent_id, priorities) ⇒ Object
- #set_torrent_max_connections(torrent_id, value) ⇒ Object
- #set_torrent_max_download_speed(torrent_id, value) ⇒ Object
- #set_torrent_max_upload_slots(torrent_id, value) ⇒ Object
- #set_torrent_max_upload_speed(torrent_id, value) ⇒ Object
- #set_torrent_move_completed(torrent_id, value) ⇒ Object
- #set_torrent_move_completed_path(torrent_id, value) ⇒ Object
- #set_torrent_options(torrent_ids, options = {}) ⇒ Object
- #set_torrent_prioritize_first_last(torrent_id, value) ⇒ Object
- #set_torrent_remove_at_ratio(torrent_id, value) ⇒ Object
- #set_torrent_stop_at_ratio(torrent_id, value) ⇒ Object
- #set_torrent_stop_ratio(torrent_id, value) ⇒ Object
- #set_torrent_trackers(torrent_id, *trackers) ⇒ Object
- #shutdown(args, kwargs = {}) ⇒ Object
- #test_listen_port ⇒ Object
- #upload_plugin(filename, filedump) ⇒ Object
Constructor Details
#initialize(host = 'localhost', port = '58846', protocol = 3) ⇒ Deluge
Returns a new instance of Deluge.
6 7 8 9 10 11 12 13 14 |
# File 'lib/deluge.rb', line 6 def initialize host='localhost', port='58846', protocol=3 @protocol = protocol if protocol == 3 @con = Protocol::V3.new(host, port) else raise "Unsupported protocol #{protocol}" end end |
Instance Method Details
#add_torrent_file(filename, filedump, options = {}) ⇒ Object
Available options: max_connections max_upload_slots max_upload_speed max_download_speed prioritize_first_last_pieces file_priorities compact_allocation download_location auto_managed stop_at_ratio stop_ratio remove_at_ratio move_completed move_completed_path add_paused
39 40 41 42 |
# File 'lib/deluge.rb', line 39 def add_torrent_file filename, filedump, ={} filedump_enc = Base64.encode64(filedump) @con.call 'core.add_torrent_file', filename, filedump_enc, , {} end |
#add_torrent_magnet(uri, options = {}) ⇒ Object
Available options: max_connections max_upload_slots max_upload_speed max_download_speed prioritize_first_last_pieces file_priorities compact_allocation download_location auto_managed stop_at_ratio stop_ratio remove_at_ratio move_completed move_completed_path add_paused
52 53 54 |
# File 'lib/deluge.rb', line 52 def add_torrent_magnet uri, ={} @con.call 'core.add_torrent_magnet', uri, , {} end |
#add_torrent_url(url, options = {}) ⇒ Object
Available options: max_connections max_upload_slots max_upload_speed max_download_speed prioritize_first_last_pieces file_priorities compact_allocation download_location auto_managed stop_at_ratio stop_ratio remove_at_ratio move_completed move_completed_path add_paused
46 47 48 |
# File 'lib/deluge.rb', line 46 def add_torrent_url url, ={} @con.call 'core.add_torrent_url', url, , {} end |
#call(*args) ⇒ Object
16 17 18 |
# File 'lib/deluge.rb', line 16 def call *args @con.call *args end |
#connect_peer(torrent_id, ip, port) ⇒ Object
81 82 83 |
# File 'lib/deluge.rb', line 81 def connect_peer torrent_id, ip, port @con.call 'core.connect_peer', torrent_id, ip, port, {} end |
#create_torrent(path, tracker, piece_length, comment, target, webseeds, privat, created_by, trackers, add_to_session) ⇒ Object
214 215 216 |
# File 'lib/deluge.rb', line 214 def create_torrent path, tracker, piece_length, comment, target, webseeds, privat, created_by, trackers, add_to_session @con.call 'core.create_torrent', path, tracker, piece_length, comment, target, webseeds, privat, created_by, trackers, add_to_session, {} end |
#disable_plugin(plugin) ⇒ Object
145 146 147 |
# File 'lib/deluge.rb', line 145 def disable_plugin plugin @con.call 'core.disable_plugin', plugin, {} end |
#enable_plugin(plugin) ⇒ Object
141 142 143 |
# File 'lib/deluge.rb', line 141 def enable_plugin plugin @con.call 'core.enable_plugin', plugin, {} end |
#force_reannounce(*torrent_ids) ⇒ Object
73 74 75 |
# File 'lib/deluge.rb', line 73 def force_reannounce *torrent_ids @con.call 'core.force_reannounce', torrent_ids, {} end |
#force_recheck(*torrent_ids) ⇒ Object
149 150 151 |
# File 'lib/deluge.rb', line 149 def force_recheck *torrent_ids @con.call 'core.force_recheck', torrent_ids, {} end |
#get_available_plugins ⇒ Object
133 134 135 |
# File 'lib/deluge.rb', line 133 def get_available_plugins @con.call 'core.get_available_plugins', {} end |
#get_cache_status ⇒ Object
69 70 71 |
# File 'lib/deluge.rb', line 69 def get_cache_status @con.call 'core.get_cache_status', {} end |
#get_config ⇒ Object
113 114 115 |
# File 'lib/deluge.rb', line 113 def get_config @con.call 'core.get_config', {} end |
#get_config_values(*keys) ⇒ Object
117 118 119 |
# File 'lib/deluge.rb', line 117 def get_config_values *keys @con.call 'core.get_config_values', keys, {} end |
#get_enabled_plugins ⇒ Object
137 138 139 |
# File 'lib/deluge.rb', line 137 def get_enabled_plugins @con.call 'core.get_enabled_plugins', {} end |
#get_filter_tree(show_zero_hits = true, hide_cat = nil) ⇒ Object
105 106 107 |
# File 'lib/deluge.rb', line 105 def get_filter_tree show_zero_hits=true, hide_cat=nil @con.call 'core.get_filter_tree', show_zero_hits, hide_cat, {} end |
#get_free_space(path = nil) ⇒ Object
258 259 260 |
# File 'lib/deluge.rb', line 258 def get_free_space path=nil @con.call 'core.get_free_space', path, {} end |
#get_libtorrent_version ⇒ Object
262 263 264 |
# File 'lib/deluge.rb', line 262 def get_libtorrent_version @con.call 'core.get_libtorrent_version' end |
#get_listen_port ⇒ Object
125 126 127 |
# File 'lib/deluge.rb', line 125 def get_listen_port @con.call 'core.get_listen_port', {} end |
#get_method_list ⇒ Object
33 34 35 |
# File 'lib/deluge.rb', line 33 def get_method_list @con.call 'daemon.get_method_list' end |
#get_num_connections ⇒ Object
129 130 131 |
# File 'lib/deluge.rb', line 129 def get_num_connections @con.call 'core.get_num_connections', {} end |
#get_path_size(path) ⇒ Object
210 211 212 |
# File 'lib/deluge.rb', line 210 def get_path_size path @con.call 'core.get_path_size', path, {} end |
#get_session_state ⇒ Object
109 110 111 |
# File 'lib/deluge.rb', line 109 def get_session_state @con.call 'core.get_session_state', {} end |
#get_session_status(keys) ⇒ Object
65 66 67 |
# File 'lib/deluge.rb', line 65 def get_session_status keys @con.call 'core.get_session_status', keys, {} end |
#get_torrent_status(torrent_id, keys, diff = false) ⇒ Object
101 102 103 |
# File 'lib/deluge.rb', line 101 def get_torrent_status torrent_id, keys, diff=false @con.call 'core.get_torrent_status', torrent_id, keys, diff, {} end |
#glob(path) ⇒ Object
250 251 252 |
# File 'lib/deluge.rb', line 250 def glob path @con.call 'core.glob', path, {} end |
#info ⇒ Object
29 30 31 |
# File 'lib/deluge.rb', line 29 def info @con.call 'daemon.info' end |
#login(username, password) ⇒ Object
20 21 22 |
# File 'lib/deluge.rb', line 20 def login username, password @con.call 'daemon.login', username, password end |
#move_storage(*torrent_ids, dest) ⇒ Object
85 86 87 |
# File 'lib/deluge.rb', line 85 def move_storage *torrent_ids, dest @con.call 'core.move_storage', torrent_ids, dest, {} end |
#pause_all_torrents ⇒ Object
89 90 91 |
# File 'lib/deluge.rb', line 89 def pause_all_torrents @con.call 'core.pause_all_torrents', {} end |
#pause_torrent(*torrent_ids) ⇒ Object
77 78 79 |
# File 'lib/deluge.rb', line 77 def pause_torrent *torrent_ids @con.call 'core.pause_torrent', torrent_ids, {} end |
#queue_bottom(*torrent_ids) ⇒ Object
246 247 248 |
# File 'lib/deluge.rb', line 246 def queue_bottom *torrent_ids @con.call 'core.queue_bottom', torrent_ids, {} end |
#queue_down(*torrent_ids) ⇒ Object
242 243 244 |
# File 'lib/deluge.rb', line 242 def queue_down *torrent_ids @con.call 'core.queue_down', torrent_ids, {} end |
#queue_top(*torrent_ids) ⇒ Object
234 235 236 |
# File 'lib/deluge.rb', line 234 def queue_top *torrent_ids @con.call 'core.queue_top', torrent_ids, {} end |
#queue_up(*torrent_ids) ⇒ Object
238 239 240 |
# File 'lib/deluge.rb', line 238 def queue_up *torrent_ids @con.call 'core.queue_up', torrent_ids, {} end |
#remove_torrent(torrent_id, remove_data: false) ⇒ Object
56 57 58 |
# File 'lib/deluge.rb', line 56 def remove_torrent torrent_id, remove_data: false @con.call 'core.remove_torrent', torrent_id, remove_data end |
#rename_files(torrent_id, filenames) ⇒ Object
226 227 228 |
# File 'lib/deluge.rb', line 226 def rename_files torrent_id, filenames @con.call 'core.rename_files', torrent_id, filenames, {} end |
#rename_folder(torrent_id, folder, new_folder) ⇒ Object
230 231 232 |
# File 'lib/deluge.rb', line 230 def rename_folder torrent_id, folder, new_folder @con.call 'core.rename_folder', torrent_id, folder, new_folder, {} end |
#rescan_plugins ⇒ Object
222 223 224 |
# File 'lib/deluge.rb', line 222 def rescan_plugins @con.call 'core.rescan_plugins', {} end |
#resume_all_torrents ⇒ Object
93 94 95 |
# File 'lib/deluge.rb', line 93 def resume_all_torrents @con.call 'core.resume_all_torrents', {} end |
#resume_torrent(*torrent_ids) ⇒ Object
97 98 99 |
# File 'lib/deluge.rb', line 97 def resume_torrent *torrent_ids @con.call 'core.resume_torrent', torrent_ids, {} end |
#set_config(config) ⇒ Object
121 122 123 |
# File 'lib/deluge.rb', line 121 def set_config config @con.call 'core.set_config', config, {} end |
#set_torrent_auto_managed(torrent_id, value) ⇒ Object
186 187 188 |
# File 'lib/deluge.rb', line 186 def set_torrent_auto_managed torrent_id, value @con.call 'core.set_torrent_auto_managed', torrent_id, value, {} end |
#set_torrent_file_priorities(torrent_id, priorities) ⇒ Object
178 179 180 |
# File 'lib/deluge.rb', line 178 def set_torrent_file_priorities torrent_id, priorities @con.call 'core.set_torrent_file_priorities', torrent_id, priorities, {} end |
#set_torrent_max_connections(torrent_id, value) ⇒ Object
162 163 164 |
# File 'lib/deluge.rb', line 162 def set_torrent_max_connections torrent_id, value @con.call 'core.set_torrent_max_connections', torrent_id, value, {} end |
#set_torrent_max_download_speed(torrent_id, value) ⇒ Object
174 175 176 |
# File 'lib/deluge.rb', line 174 def set_torrent_max_download_speed torrent_id, value @con.call 'core.set_torrent_max_download_speed', torrent_id, value, {} end |
#set_torrent_max_upload_slots(torrent_id, value) ⇒ Object
166 167 168 |
# File 'lib/deluge.rb', line 166 def set_torrent_max_upload_slots torrent_id, value @con.call 'core.set_torrent_max_upload_stats', torrent_id, value, {} end |
#set_torrent_max_upload_speed(torrent_id, value) ⇒ Object
170 171 172 |
# File 'lib/deluge.rb', line 170 def set_torrent_max_upload_speed torrent_id, value @con.call 'core.set_torrent_max_upload_speed', torrent_id, value, {} end |
#set_torrent_move_completed(torrent_id, value) ⇒ Object
202 203 204 |
# File 'lib/deluge.rb', line 202 def set_torrent_move_completed torrent_id, value @con.call 'core.set_torrent_move_completed', torrent_id, value, {} end |
#set_torrent_move_completed_path(torrent_id, value) ⇒ Object
206 207 208 |
# File 'lib/deluge.rb', line 206 def set_torrent_move_completed_path torrent_id, value @con.call 'core.set_torrent_move_completed_path', torrent_id, value, {} end |
#set_torrent_options(torrent_ids, options = {}) ⇒ Object
153 154 155 156 |
# File 'lib/deluge.rb', line 153 def torrent_ids, ={} torrent_ids = [torrent_ids] unless torrent_ids.kind_of?(Array) @con.call 'core.set_torrent_options',torrent_ids, , {} end |
#set_torrent_prioritize_first_last(torrent_id, value) ⇒ Object
182 183 184 |
# File 'lib/deluge.rb', line 182 def set_torrent_prioritize_first_last torrent_id, value @con.call 'core.set_torrent_prioritize_first_last', torrent_id, value, {} end |
#set_torrent_remove_at_ratio(torrent_id, value) ⇒ Object
198 199 200 |
# File 'lib/deluge.rb', line 198 def set_torrent_remove_at_ratio torrent_id, value @con.call 'core.set_torrent_remove_at_ratio', torrent_id, value, {} end |
#set_torrent_stop_at_ratio(torrent_id, value) ⇒ Object
190 191 192 |
# File 'lib/deluge.rb', line 190 def set_torrent_stop_at_ratio torrent_id, value @con.call 'core.set_torrent_stop_at_ratio', torrent_id, value, {} end |
#set_torrent_stop_ratio(torrent_id, value) ⇒ Object
194 195 196 |
# File 'lib/deluge.rb', line 194 def set_torrent_stop_ratio torrent_id, value @con.call 'core.set_torrent_stop_ratio', torrent_id, value, {} end |
#set_torrent_trackers(torrent_id, *trackers) ⇒ Object
158 159 160 |
# File 'lib/deluge.rb', line 158 def set_torrent_trackers torrent_id, *trackers @con.call 'core.set_torrent_trackers', torrent_id, trackers, {} end |
#shutdown(args, kwargs = {}) ⇒ Object
24 25 26 27 |
# File 'lib/deluge.rb', line 24 def shutdown args, kwargs={} args = [args] unless args.is_a?(Array) @con.call 'daemon.shutdown', args, kwargs end |
#test_listen_port ⇒ Object
254 255 256 |
# File 'lib/deluge.rb', line 254 def test_listen_port @con.call 'core.test_listen_port', {} end |
#upload_plugin(filename, filedump) ⇒ Object
218 219 220 |
# File 'lib/deluge.rb', line 218 def upload_plugin filename, filedump @con.call 'core.upload_plugin', filename, filedump, {} end |