deluge-rpc 0.1.3 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.ruby-version +1 -1
- data/README.md +7 -4
- data/deluge-rpc.gemspec +7 -4
- data/lib/deluge/rpc/connection.rb +14 -11
- data/lib/deluge/rpc/version.rb +1 -1
- metadata +31 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 48dc5778e785c4c3d33e6d6346cb5611697df894cac0876a353aca0df205564a
|
4
|
+
data.tar.gz: b37ffe6f233367b2fc14c53c66f5f20e6ee485c4c9dfc0828777d081e249c2e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '04995d0ba11452edd757ffff2a3a04fa60acf97db735aa74996d9c6a8af7f2eaeffc83c44ed3f8798ddaf24a90bd59e13b1c33e55d072d095a3af7fa70ea1687'
|
7
|
+
data.tar.gz: a974c420628b8415bc9dcf0f48c71c41b77a07e825d321f4f4294c752d2f4bf074da42220d2082cf35ab42849dc3b4b6cc4807fcf6ea8e0cd27b6503d54eca86
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.7.2
|
data/README.md
CHANGED
@@ -1,14 +1,16 @@
|
|
1
1
|
# Deluge::RPC
|
2
2
|
|
3
|
-
Ruby RPC client library for Deluge torrent client.
|
3
|
+
Ruby RPC client library for Deluge 2.0+ torrent client.
|
4
4
|
Provides dynamic API bindings depending on RPC server.
|
5
5
|
Multi-threading friendly, thanks to ``concurrent-ruby`` gem.
|
6
6
|
|
7
|
+
Deluge 1.x is not supported anymore.
|
8
|
+
|
7
9
|
Official RPC protocol documentation:
|
8
|
-
|
10
|
+
https://deluge.readthedocs.io/en/latest/reference/rpc.html
|
9
11
|
|
10
12
|
Deluge RPC API reference:
|
11
|
-
|
13
|
+
https://deluge.readthedocs.io/en/latest/reference/api.html
|
12
14
|
|
13
15
|
## Usage
|
14
16
|
|
@@ -103,7 +105,8 @@ Avoid time-consuming code!
|
|
103
105
|
This list was extracted from Deluge 1.3.11 sources. Events for your version could be different.
|
104
106
|
There is no official documentation.
|
105
107
|
|
106
|
-
Current events could be found here:
|
108
|
+
Current events could be found here:
|
109
|
+
https://github.com/deluge-torrent/deluge/blob/master/deluge/event.py
|
107
110
|
|
108
111
|
## Installation
|
109
112
|
|
data/deluge-rpc.gemspec
CHANGED
@@ -12,14 +12,17 @@ Gem::Specification.new do |spec|
|
|
12
12
|
spec.description = %q{Communicate with Deluge torrent client via RPC protocol}
|
13
13
|
spec.homepage = "https://github.com/t3hk0d3/deluge-rpc"
|
14
14
|
spec.license = "MIT"
|
15
|
+
spec.required_ruby_version = '>= 2.6' # rubocop:disable Gemspec/RequiredRubyVersion
|
15
16
|
|
16
17
|
spec.files = `git ls-files -z`.split("\x0")
|
17
18
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
19
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
20
|
spec.require_paths = ["lib"]
|
20
21
|
|
21
|
-
spec.add_dependency 'concurrent-ruby', '~>
|
22
|
-
spec.add_dependency 'rencoder', '~> 0.
|
23
|
-
|
24
|
-
spec.add_development_dependency 'rspec', '~> 3.
|
22
|
+
spec.add_dependency 'concurrent-ruby', '~> 1.1.8'
|
23
|
+
spec.add_dependency 'rencoder', '~> 0.2'
|
24
|
+
|
25
|
+
spec.add_development_dependency 'rspec', '~> 3.10.0'
|
26
|
+
spec.add_development_dependency 'rubocop', '~> 0.90'
|
27
|
+
spec.add_development_dependency 'rubocop-rspec', '~> 1.43'
|
25
28
|
end
|
@@ -1,4 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'rencoder'
|
4
|
+
|
2
5
|
require 'socket'
|
3
6
|
require 'openssl'
|
4
7
|
require 'thread'
|
@@ -14,6 +17,8 @@ module Deluge
|
|
14
17
|
class InvokeTimeoutError < StandardError; end
|
15
18
|
class ConnectionClosedError < StandardError; end
|
16
19
|
|
20
|
+
PROTOCOL_VERSION = 0x01
|
21
|
+
|
17
22
|
DAEMON_LOGIN = 'daemon.login'
|
18
23
|
DAEMON_METHOD_LIST = 'daemon.get_method_list'
|
19
24
|
DAEMON_REGISTER_EVENT = 'daemon.set_event_interest'
|
@@ -102,7 +107,7 @@ module Deluge
|
|
102
107
|
result = future.value!(@call_timeout)
|
103
108
|
|
104
109
|
if result.nil? && future.pending?
|
105
|
-
raise InvokeTimeoutError.new("Failed to
|
110
|
+
raise InvokeTimeoutError.new("Failed to retrieve response for '#{method}' in #{@call_timeout} seconds. Probably method not exists.")
|
106
111
|
end
|
107
112
|
|
108
113
|
result
|
@@ -167,6 +172,7 @@ module Deluge
|
|
167
172
|
|
168
173
|
def write_packet(packet)
|
169
174
|
raw = Zlib::Deflate.deflate Rencoder.dump(packet)
|
175
|
+
raw = [PROTOCOL_VERSION, raw.bytesize].pack("CN") + raw
|
170
176
|
|
171
177
|
@write_mutex.synchronize do
|
172
178
|
if IO.select([], [@connection], nil, nil)
|
@@ -177,11 +183,13 @@ module Deluge
|
|
177
183
|
|
178
184
|
def read_packets(socket)
|
179
185
|
raw = ""
|
180
|
-
begin
|
181
|
-
buffer = socket.readpartial(1024)
|
182
|
-
raw += buffer
|
183
|
-
end until(buffer.size < 1024)
|
184
186
|
|
187
|
+
# Read message header
|
188
|
+
protocol_version, buffer_size = socket.readpartial(5).unpack('CN')
|
189
|
+
|
190
|
+
raise('Received response with unknown protocol_version=' + protocol_version) if protocol_version != PROTOCOL_VERSION
|
191
|
+
|
192
|
+
raw = socket.readpartial(buffer_size)
|
185
193
|
raw = Zlib::Inflate.inflate(raw)
|
186
194
|
|
187
195
|
parse_packets(raw)
|
@@ -210,12 +218,7 @@ module Deluge
|
|
210
218
|
end
|
211
219
|
|
212
220
|
def ssl_context
|
213
|
-
|
214
|
-
context = OpenSSL::SSL::SSLContext.new('SSLv23')
|
215
|
-
# TODO: Consider allowing server certificate validation
|
216
|
-
context.set_params(verify_mode: OpenSSL::SSL::VERIFY_NONE)
|
217
|
-
|
218
|
-
context
|
221
|
+
OpenSSL::SSL::SSLContext.new
|
219
222
|
end
|
220
223
|
|
221
224
|
def parse_packets(raw)
|
data/lib/deluge/rpc/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: deluge-rpc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Igor Yamolov
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -16,56 +16,70 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 1.1.8
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 1.1.8
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rencoder
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0.
|
33
|
+
version: '0.2'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0.
|
40
|
+
version: '0.2'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 3.10.0
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 3.10.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: rubocop
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.90'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.90'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop-rspec
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
73
|
- - "~>"
|
60
74
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
75
|
+
version: '1.43'
|
62
76
|
type: :development
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
80
|
- - "~>"
|
67
81
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
82
|
+
version: '1.43'
|
69
83
|
description: Communicate with Deluge torrent client via RPC protocol
|
70
84
|
email:
|
71
85
|
- clouster@yandex.ru
|
@@ -93,7 +107,7 @@ homepage: https://github.com/t3hk0d3/deluge-rpc
|
|
93
107
|
licenses:
|
94
108
|
- MIT
|
95
109
|
metadata: {}
|
96
|
-
post_install_message:
|
110
|
+
post_install_message:
|
97
111
|
rdoc_options: []
|
98
112
|
require_paths:
|
99
113
|
- lib
|
@@ -101,20 +115,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
101
115
|
requirements:
|
102
116
|
- - ">="
|
103
117
|
- !ruby/object:Gem::Version
|
104
|
-
version: '
|
118
|
+
version: '2.6'
|
105
119
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
120
|
requirements:
|
107
121
|
- - ">="
|
108
122
|
- !ruby/object:Gem::Version
|
109
123
|
version: '0'
|
110
124
|
requirements: []
|
111
|
-
|
112
|
-
|
113
|
-
signing_key:
|
125
|
+
rubygems_version: 3.1.4
|
126
|
+
signing_key:
|
114
127
|
specification_version: 4
|
115
128
|
summary: Deluge RPC protocol wrapper
|
116
129
|
test_files:
|
117
130
|
- spec/deluge/api/client_spec.rb
|
118
131
|
- spec/deluge/api/namespace_spec.rb
|
119
132
|
- spec/spec_helper.rb
|
120
|
-
has_rdoc:
|