obsws 0.1.1 → 0.1.3

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
2
  SHA256:
3
- metadata.gz: 3ac01e29c9776d0288fc46118847ca4054596a940173b68aec224fb888a7d6ed
4
- data.tar.gz: baef83a80ef328743d2579a74d31d7e9b6bc46203f6a5e0af4072dfa08a26ed7
3
+ metadata.gz: 7305724ce1b19455dc9e9cbcfdb43691cc5bfb8d5cf66a54917aeadcf26a7ea2
4
+ data.tar.gz: 8b1423cb39e96c9af4357e4eae624f3654b678ba547d3f9758adad40714e0a2e
5
5
  SHA512:
6
- metadata.gz: 71f5a718e0dfaec48b05f4f8a1e49637f0d60a20f56d8870987588cfe4ae1938b67d04043fae20cc612d1f61d8d48b22cff3a908ffe045fb0b1bbf432736f00a
7
- data.tar.gz: 7a95faceaa4022bab0c8045b7068bca4ceee6a86a4e21c303e34a589cbc80d45b358ba2f12a365c8c45abed5c2eae4a5b49ae4ea97ac45c06bcf743ab8a796a4
6
+ metadata.gz: 271c5e2b12ee3cae82fd2069ec66c64d58681f24bc85cf4a841bdfa981900e28512b5c8d827dce7932c22b53d72ded9d7f7798b4858a9b92145c59f7bdd9f0ed
7
+ data.tar.gz: ccb732c3e56389adb277492cf8bf0af0ff69a59687e46866618eb5fa75ad06c90ee65de4e7f191f6e618a23e19b35117871bfc614bcd3a4f399712d684c5bbd1
data/README.md CHANGED
@@ -115,6 +115,19 @@ If a request fails an `OBSWSError` will be raised with a status code.
115
115
 
116
116
  For a full list of status codes refer to [Codes](https://github.com/obsproject/obs-websocket/blob/master/docs/generated/protocol.md#requeststatus)
117
117
 
118
+ ### Logging
119
+
120
+ To see the raw messages set log level to debug
121
+
122
+ example:
123
+
124
+ ```ruby
125
+ require "obsws"
126
+
127
+ OBSWS::LOGGER.debug!
128
+ ...
129
+ ```
130
+
118
131
  ### Tests
119
132
 
120
133
  To run all tests:
data/lib/obsws/base.rb CHANGED
@@ -45,12 +45,12 @@ module OBSWS
45
45
  @closed = true
46
46
  end
47
47
  @driver.on :message do |msg|
48
- LOGGER.debug("received [#{msg}] passing to handler")
48
+ LOGGER.debug("received: #{msg.data}")
49
49
  msg_handler(JSON.parse(msg.data, symbolize_names: true))
50
50
  end
51
51
  start_driver
52
52
  WaitUtil.wait_for_condition(
53
- "waiting successful identification",
53
+ "successful identification",
54
54
  delay_sec: 0.01,
55
55
  timeout_sec: 3
56
56
  ) { @identified }
@@ -75,7 +75,6 @@ module OBSWS
75
75
  end
76
76
 
77
77
  def identify(auth)
78
- LOGGER.info("initiating authentication") if auth
79
78
  payload = {
80
79
  op: Mixin::OPCodes::IDENTIFY,
81
80
  d: {
@@ -83,7 +82,13 @@ module OBSWS
83
82
  eventSubscriptions: @subs
84
83
  }
85
84
  }
86
- payload[:d][:authentication] = auth_token(**auth) if auth
85
+ if auth
86
+ if @password.empty?
87
+ raise OBSWSError("auth enabled but no password provided")
88
+ end
89
+ LOGGER.info("initiating authentication")
90
+ payload[:d][:authentication] = auth_token(**auth)
91
+ end
87
92
  @driver.text(JSON.generate(payload))
88
93
  end
89
94
 
@@ -108,8 +113,8 @@ module OBSWS
108
113
  }
109
114
  }
110
115
  payload[:d][:requestData] = data if data
116
+ LOGGER.debug("sending request: #{payload}")
111
117
  queued = @driver.text(JSON.generate(payload))
112
- LOGGER.debug("request with id #{id} queued? #{queued}")
113
118
  end
114
119
  end
115
120
  end
data/lib/obsws/req.rb CHANGED
@@ -28,7 +28,7 @@ module OBSWS
28
28
  ensure
29
29
  close
30
30
  WaitUtil.wait_for_condition(
31
- "driver has closed",
31
+ "driver to close",
32
32
  delay_sec: 0.01,
33
33
  timeout_sec: 1
34
34
  ) { @base_client.closed }
@@ -42,7 +42,7 @@ module OBSWS
42
42
  id = rand(1..1000)
43
43
  @base_client.req(id, req, data)
44
44
  WaitUtil.wait_for_condition(
45
- "reponse id matches request id",
45
+ "reponse id to match request id",
46
46
  delay_sec: 0.001,
47
47
  timeout_sec: 3
48
48
  ) { @response[:requestId] == id }
data/lib/obsws/version.rb CHANGED
@@ -11,7 +11,7 @@ module OBSWS
11
11
  end
12
12
 
13
13
  def patch
14
- 1
14
+ 3
15
15
  end
16
16
 
17
17
  def to_a
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.1.1
4
+ version: 0.1.3
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-11-18 00:00:00.000000000 Z
11
+ date: 2022-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: observer