Closed T-vK closed 1 year ago
Wrong: "obs-websocket-py version: 0.5.3" only works with obs-websocket 4.9.1-compat. There is no released version (yet) that works with obs-websocket 5. You can try installing obs-websocket-py from git, but I have no idea how feature-complete that version is:
pip install git+https://github.com/Elektordi/obs-websocket-py.git@master
I see, thanks!
I was able to successfully connect now, but I keep getting Your request type is not valid
messages:
DEBUG:obswebsocket.core:Got answer for id 1: {'d': {'requestId': '1', 'requestStatus': {'code': 204, 'comment': 'Your request type is not valid.', 'result': False}, 'requestType': 'StopRecording'}, 'op': 7}
Any ideas why? Is that what you meant by "not feature-complete"?
I was using this script btw:
#!/usr/bin/env python3
import sys
import time
import logging
logging.basicConfig(level=logging.DEBUG)
sys.path.append('../')
from obswebsocket import obsws, events, requests # noqa: E402
host = "localhost"
port = 4455
password = "secret"
def on_recording_stopped(recordingFilename):
print("File recorded {}".format(recordingFilename))
ws = obsws(host, port, password)
ws.register(on_recording_stopped, events.RecordingStopped)
ws.connect()
try:
print("OK")
ws.call(requests.StopRecording())
time.sleep(10)
print("END")
except KeyboardInterrupt:
pass
ws.disconnect()
Okay... I finally got it to work. Seems like everything got renamed. RecordingStopped
is now RecordStateChanged
and StopRecording
is now StopRecord
...
#!/usr/bin/env python3
import sys
import time
#import logging
#logging.basicConfig(level=logging.DEBUG)
sys.path.append('../')
from obswebsocket import obsws, events, requests # noqa: E402
host = "localhost"
port = 4455
password = "secret"
def on_recording_state_change(event):
outputState = event.datain.get('outputState')
if outputState == 'OBS_WEBSOCKET_OUTPUT_STOPPED':
recordedFilename = event.datain.get('outputPath')
print(recordedFilename)
ws = obsws(host, port, password)
ws.register(on_recording_state_change, events.RecordStateChanged)
ws.connect()
try:
print("OK")
ws.call(requests.StopRecord())
time.sleep(10)
print("END")
except KeyboardInterrupt:
pass
ws.disconnect()
Yes, they changed all names when switching the protocol to v5! I'm happy to know you was able to test the new version, and it worked. Thanks.
obs-websocket-py version: 0.5.3 OBS Studio version: 29.0.2 OS: Linux (Fedora)
When trying to connect I get this error:
KeyError: 'status'
:As #77 and #81 have been closed, I am assuming that I don't need the ´4.9.1-compat´ anymore. Correct?