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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 8fdcfe0656ef321dd54ac8d8f5a8f788bcd17cd6
4
- data.tar.gz: 1157ad39d1fbfe536fb1d35ed4c72c8dc16cad6f
2
+ SHA256:
3
+ metadata.gz: 48dc5778e785c4c3d33e6d6346cb5611697df894cac0876a353aca0df205564a
4
+ data.tar.gz: b37ffe6f233367b2fc14c53c66f5f20e6ee485c4c9dfc0828777d081e249c2e5
5
5
  SHA512:
6
- metadata.gz: c2d795c706720dff717af01890ec926fb258444353456fe725dde872ba83c9a22e7d724760719daab364975f2dbd8136dfa6f605e338c798894e7b9e5b4aeb30
7
- data.tar.gz: 4225adb085e5dceab4e3e7268335cfaddad2b53c9b62ada57df808cf69f1ca0644f000cc4ebc3636f512b24e7e597686b49456dd7e1d011692c2d0eb2f25d15c
6
+ metadata.gz: '04995d0ba11452edd757ffff2a3a04fa60acf97db735aa74996d9c6a8af7f2eaeffc83c44ed3f8798ddaf24a90bd59e13b1c33e55d072d095a3af7fa70ea1687'
7
+ data.tar.gz: a974c420628b8415bc9dcf0f48c71c41b77a07e825d321f4f4294c752d2f4bf074da42220d2082cf35ab42849dc3b4b6cc4807fcf6ea8e0cd27b6503d54eca86
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.1.4
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
- http://deluge.readthedocs.org/en/develop/core/rpc.html
10
+ https://deluge.readthedocs.io/en/latest/reference/rpc.html
9
11
 
10
12
  Deluge RPC API reference:
11
- http://deluge.readthedocs.org/en/develop/core/rpc.html#remote-api
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: http://git.deluge-torrent.org/deluge/tree/deluge/event.py
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', '~> 0.7'
22
- spec.add_dependency 'rencoder', '~> 0.1'
23
- spec.add_development_dependency 'bundler', '~> 1.7'
24
- spec.add_development_dependency 'rspec', '~> 3.1'
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 retreive response for '#{method}' in #{@call_timeout} seconds. Probably method not exists.")
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
- # SSLv3 is not allowed (http://dev.deluge-torrent.org/ticket/2555)
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)
@@ -1,5 +1,5 @@
1
1
  module Deluge
2
2
  module Rpc
3
- VERSION = "0.1.3"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
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.1.3
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: 2015-06-17 00:00:00.000000000 Z
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: '0.7'
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: '0.7'
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.1'
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.1'
40
+ version: '0.2'
41
41
  - !ruby/object:Gem::Dependency
42
- name: bundler
42
+ name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '1.7'
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: '1.7'
54
+ version: 3.10.0
55
55
  - !ruby/object:Gem::Dependency
56
- name: rspec
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: '3.1'
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: '3.1'
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: '0'
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
- rubyforge_project:
112
- rubygems_version: 2.2.2
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: