obsws 0.4.0 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/obsws/base.rb +1 -2
- data/lib/obsws/event.rb +5 -3
- data/lib/obsws/logger.rb +1 -1
- data/lib/obsws/mixin.rb +4 -4
- data/lib/obsws/req.rb +2 -2
- data/lib/obsws/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ccc4e19da8ea0f009572ea75a5f47b414c7d4e5d50955ae856eb4063081ca70
|
4
|
+
data.tar.gz: 2a5ec2b70667d2b80483a46c898920ed9a97d937478e45ff5f643b8e28919a18
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0875434a8e3c58d82fbc0deb3be4478ab495000b37ee6282d321e32963d623dcc241c62a0257ef009ab6981ef134138e6e72ab76a1f552d46a3b928f1acc21d4'
|
7
|
+
data.tar.gz: 3b944c1a4ac416f12a0f5d821d73979ac4f344fa2ae186f04a0d00998bc5adf9fcf744e874d4b52f273232aec174a2da134a94f5bcd24d522d25e2b778c7bd9f
|
data/lib/obsws/base.rb
CHANGED
@@ -21,8 +21,7 @@ module OBSWS
|
|
21
21
|
port = kwargs[:port] || 4455
|
22
22
|
@password = kwargs[:password] || ""
|
23
23
|
@subs = kwargs[:subs] || 0
|
24
|
-
setup_driver(host, port)
|
25
|
-
start_driver
|
24
|
+
setup_driver(host, port) and start_driver
|
26
25
|
WaitUtil.wait_for_condition(
|
27
26
|
"successful identification",
|
28
27
|
delay_sec: 0.01,
|
data/lib/obsws/event.rb
CHANGED
@@ -42,15 +42,16 @@ module OBSWS
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def add_observer(observer)
|
45
|
-
observer = [observer]
|
45
|
+
observer = [observer] unless observer.respond_to? :each
|
46
46
|
observer.each { |o| observers << o unless observers.include? o }
|
47
47
|
end
|
48
48
|
|
49
49
|
def remove_observer(observer)
|
50
|
-
|
50
|
+
observer = [observer] unless observer.respond_to? :each
|
51
|
+
observers.reject! { |o| observer.include? o }
|
51
52
|
end
|
52
53
|
|
53
|
-
def notify_observers(event, data)
|
54
|
+
private def notify_observers(event, data)
|
54
55
|
observers.each do |o|
|
55
56
|
if o.is_a? Method
|
56
57
|
if o.name.to_s == "on_#{snakecase(event)}"
|
@@ -62,6 +63,7 @@ module OBSWS
|
|
62
63
|
end
|
63
64
|
end
|
64
65
|
|
66
|
+
alias_method :callbacks, :observers
|
65
67
|
alias_method :register, :add_observer
|
66
68
|
alias_method :deregister, :remove_observer
|
67
69
|
end
|
data/lib/obsws/logger.rb
CHANGED
@@ -3,7 +3,7 @@ require "logger"
|
|
3
3
|
module OBSWS
|
4
4
|
module Logging
|
5
5
|
def logger
|
6
|
-
@logger
|
6
|
+
@logger ||= Logger.new($stdout, level: ENV.fetch("OBSWS_LOG_LEVEL", "WARN"))
|
7
7
|
@logger.progname = instance_of?(::Module) ? name : self.class.name
|
8
8
|
@logger
|
9
9
|
end
|
data/lib/obsws/mixin.rb
CHANGED
@@ -26,11 +26,11 @@ module OBSWS
|
|
26
26
|
def attrs = @fields.map { |f| snakecase(f.to_s) }
|
27
27
|
end
|
28
28
|
|
29
|
-
class Response < MetaObject
|
30
|
-
|
29
|
+
class Response < MetaObject; end
|
30
|
+
# Represents a request response object
|
31
31
|
|
32
|
-
class Data < MetaObject
|
33
|
-
|
32
|
+
class Data < MetaObject; end
|
33
|
+
# Represents an event data object
|
34
34
|
|
35
35
|
module TearDown
|
36
36
|
def stop_driver
|
data/lib/obsws/req.rb
CHANGED
@@ -47,12 +47,12 @@ module OBSWS
|
|
47
47
|
delay_sec: 0.001,
|
48
48
|
timeout_sec: 3
|
49
49
|
) { @response[:requestId] == id }
|
50
|
-
|
50
|
+
unless @response[:requestStatus][:result]
|
51
51
|
error = [
|
52
52
|
"Request #{@response[:requestType]} returned code #{@response[:requestStatus][:code]}"
|
53
53
|
]
|
54
54
|
if @response[:requestStatus].key?(:comment)
|
55
|
-
error
|
55
|
+
error << ["With message: #{@response[:requestStatus][:comment]}"]
|
56
56
|
end
|
57
57
|
raise OBSWSError.new(error.join("\n"))
|
58
58
|
end
|
data/lib/obsws/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: obsws
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- onyx_online
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-08-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: websocket-driver
|