obsws 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -0
- data/LICENSE +21 -0
- data/README.md +1 -1
- data/lib/obsws/base.rb +15 -13
- data/lib/obsws/req.rb +4 -0
- data/lib/obsws/version.rb +1 -1
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 951d942da5f3b7b0895acdd2921ac74b1fa21a1f3e4a56e58ea58c053ca2a51e
|
4
|
+
data.tar.gz: 5f1c953ecfe4b187b63f2aae17cae497e5475dc049c7fb06a5d84451795e7ae3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6aacbdc428e859c97669718b2df5f447fb6a136dd9def91b87613c40b7f25798236db96ddb3c29d629b30dbcebc8250f2566334fa5c82572eec4d9cf64e140f
|
7
|
+
data.tar.gz: d2729c6a1d9c50c37dac5f204d2d654375822b3f70911a420ba81b386d75f8afa2e5f7ead8cce0e496b12d221afeacaa9987119465136da19342c42785fc7102
|
data/CHANGELOG.md
CHANGED
@@ -0,0 +1,17 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
|
+
|
8
|
+
Before any major/minor/patch bump all unit tests will be run to verify they pass.
|
9
|
+
|
10
|
+
## [0.0.1] - 2021-10-22
|
11
|
+
|
12
|
+
### Added
|
13
|
+
|
14
|
+
- Initial Commit
|
15
|
+
- Base class, Request and Event client classes.
|
16
|
+
- Unit tests
|
17
|
+
- README.md
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2022 Onyx and Iris
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
CHANGED
data/lib/obsws/base.rb
CHANGED
@@ -37,11 +37,8 @@ module OBSWS
|
|
37
37
|
@socket = TCPSocket.new(host, port)
|
38
38
|
@driver =
|
39
39
|
WebSocket::Driver.client(Socket.new("ws://#{host}:#{port}", @socket))
|
40
|
-
@ready = false
|
41
|
-
@closed = false
|
42
40
|
@driver.on :open do |msg|
|
43
41
|
LOGGER.debug("driver socket open")
|
44
|
-
@ready = true
|
45
42
|
end
|
46
43
|
@driver.on :close do |msg|
|
47
44
|
LOGGER.debug("driver socket closed")
|
@@ -51,21 +48,23 @@ module OBSWS
|
|
51
48
|
LOGGER.debug("received [#{msg}] passing to handler")
|
52
49
|
msg_handler(JSON.parse(msg.data, symbolize_names: true))
|
53
50
|
end
|
54
|
-
|
51
|
+
start_driver
|
55
52
|
WaitUtil.wait_for_condition(
|
56
|
-
"
|
53
|
+
"waiting authentication successful",
|
57
54
|
delay_sec: 0.01,
|
58
|
-
timeout_sec:
|
59
|
-
) { @
|
55
|
+
timeout_sec: 3
|
56
|
+
) { @authenticated }
|
60
57
|
end
|
61
58
|
|
62
59
|
def start_driver
|
63
|
-
|
60
|
+
Thread.new do
|
61
|
+
@driver.start
|
64
62
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
63
|
+
loop do
|
64
|
+
@driver.parse(@socket.readpartial(4096))
|
65
|
+
rescue EOFError
|
66
|
+
break
|
67
|
+
end
|
69
68
|
end
|
70
69
|
end
|
71
70
|
|
@@ -85,6 +84,7 @@ module OBSWS
|
|
85
84
|
eventSubscriptions: @subs
|
86
85
|
}
|
87
86
|
}
|
87
|
+
LOGGER.debug("initiating authentication")
|
88
88
|
@driver.text(JSON.generate(payload))
|
89
89
|
end
|
90
90
|
|
@@ -92,9 +92,11 @@ module OBSWS
|
|
92
92
|
op_code = data[:op]
|
93
93
|
case op_code
|
94
94
|
when Mixin::OPCodes::HELLO
|
95
|
+
LOGGER.debug("hello received, passing to auth")
|
95
96
|
authenticate(data[:d][:authentication])
|
96
97
|
when Mixin::OPCodes::IDENTIFIED
|
97
|
-
LOGGER.debug("
|
98
|
+
LOGGER.debug("authentication successful")
|
99
|
+
@authenticated = true
|
98
100
|
when Mixin::OPCodes::EVENT, Mixin::OPCodes::REQUESTRESPONSE
|
99
101
|
changed
|
100
102
|
notify_observers(op_code, data[:d])
|
data/lib/obsws/req.rb
CHANGED
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.0.
|
4
|
+
version: 0.0.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: 2022-10-
|
11
|
+
date: 2022-10-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: observer
|
@@ -106,15 +106,17 @@ dependencies:
|
|
106
106
|
- - ">="
|
107
107
|
- !ruby/object:Gem::Version
|
108
108
|
version: 11.2.2
|
109
|
-
description: A Ruby wrapper around
|
109
|
+
description: A Ruby wrapper around OBS Websocket v5
|
110
110
|
email: code@onyxandiris.online
|
111
111
|
executables: []
|
112
112
|
extensions: []
|
113
113
|
extra_rdoc_files:
|
114
114
|
- README.md
|
115
115
|
- CHANGELOG.md
|
116
|
+
- LICENSE
|
116
117
|
files:
|
117
118
|
- CHANGELOG.md
|
119
|
+
- LICENSE
|
118
120
|
- README.md
|
119
121
|
- lib/obsws.rb
|
120
122
|
- lib/obsws/base.rb
|
@@ -144,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
144
146
|
- !ruby/object:Gem::Version
|
145
147
|
version: '0'
|
146
148
|
requirements: []
|
147
|
-
rubygems_version: 3.3.
|
149
|
+
rubygems_version: 3.3.7
|
148
150
|
signing_key:
|
149
151
|
specification_version: 4
|
150
152
|
summary: OBS Websocket v5 wrapper
|