Giter VIP home page Giter VIP logo

obsws-python's People

Contributors

aatikturk avatar kamalmostafa avatar onyx-and-iris avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

obsws-python's Issues

AttributeError: module 'obsstudio_sdk' has no attribute 'ReqClient'

Trying to use this module to replace obs-websocket-py and I'm using Python 3.11.0b5.

I'm trying the sample code provided in the Readme:

import obsstudio_sdk as obs
self.obs = obs.ReqClient(self.server_address, self.server_port, self.server_password)

and I'm getting this error:

AttributeError: module 'obsstudio_sdk' has no attribute 'ReqClient'

Any idea where I'm going wrong?

Are batches supported?

Hi,

Does obsws-python support batch requests? There's only one place in the source that batches are mentioned (in the documentation for sleep()), which implies both that batches aren't supported (because they aren't otherwise mentioned), and that they are supported (because sleep() isn't useful outside of batches).

Could you please clarify? Thanks!

Plans for asyncio-compliant interface?

Since websockets are pure I/O, there would be significant advantages in providing an async-compliant interface for asynchronous scripts and programs. Has this been considered?

pwinstaller misses obsws

I have a simple script, and step 1 is : import obsws_python as obs

It works great when run as python script.py

But then when I do a pyinstaller --onefile script.py

It keeps missing obsws. When I run the resulting EXE i get:

Traceback (most recent call last):
  File "myscript.py", line 7, in <module>
    import obsws_python as obs
ModuleNotFoundError: No module named 'obsws_python'
[4408] Failed to execute script 'myscript' due to unhandled exception!

Is there something you can include in the package so that obsws can be included in a pwinstaller? I have tried the usual --include-hidden type options already.

Note: all my other import modules are working fine.

ta

Not able to store the responses

Hi, I have an issue with fetching the responses. This package helps a lot with all of the OBS functionalities, but I am unable to fetch and store the response in a variable.

I can only print the response on screen using debug logging, but there seems to be no way to fetch and store the variable. Am I missing something here?

How Do I Set The Output File Name for a Video?

Hi,

I am assuming I need to use set_output_settings but I don't know how to fill in the field. For example say I wanted the video saved to be called "TestFile.mp4", how would I achieve this?

Thanks!

How to get Event of 'GUI start/stop record'

It's amazing of obs websocket. Your code is simple and useful. Further, I want to use it to synchronize obs with other DAQ system.

I see this code work for me. However, how to register that like 'Event: RecordStatusChanged'.

cl.start_record()
cl.stop_record()

email through site.

Hello, I've sent you an email through the site if you could let me know your thoughts when you get a spare moment.

Thank you.

Trigger hotkey by name only works halfway

Hello!

I am trying to run a bit of code to show and then hide a scene item. (example, show video, then hide)
The problem is that it will only work partly. For example if I send:
cl.trigger_hot_key_by_name('libobs.show_scene_item.FLASHBANG') (my scene name is FLASHBANG, a short video)
it will successfully play, but then when I send:
cl.trigger_hot_key_by_name('libobs.hide_scene_item.FLASHBANG')
nothing happens.

The weirdest part, sometimes this only works the other way around.
I stripped all my code until I got the simplest bit with the error:

`import obsws_python as obs
from time import sleep

cl = obs.ReqClient()

cl.trigger_hot_key_by_name('libobs.show_scene_item.FLASHBANG')
sleep(2)
cl.trigger_hot_key_by_name('libobs.hide_scene_item.FLASHBANG')`

I'll also include my config.toml if that helps (removing my password of course)
[connection] host = "192.168.0.21" port = #### password = "####"

Last thing to mention; I've tried this with multiple scenes (text, image), same issue all around.

config.toml only works in obs-studio folder

First off, I'm on windows 10, obs 29, and python 3.10, writing a python script. I wasn't getting the config.toml to provide connection details via a parameterless call to ReqClient(), so I stepped through with vscode via a launch.json set to attach to the obs process id and justmycode set to false. So, I load my script in obs with a breakpoint on _conn_from_toml and it turns out Path.cwd() in baseclient.py:40 is returning my obs path, not the script's path. Technically I can handle that by just putting the file in there, but this behavior is contrary to the readme so I thought I should reach out for documentation's sake.

Connection times out after few hours and cannot reconnect again

Hello,

I have working script that fails after after few hours of successful run.

This is how I start the connection

cl = obs.ReqClient(host='localhost', port=4455, password='foo', timeout=30)

After a while it stops with a timeout.

websocket._exceptions.WebSocketTimeoutException: Connection timed out

Any suggestions other than restarting?

Setting text and retrieving transform data for text results in stale transform data

In Python, I am working on some code that changes text in OBS and then centers the text element.

Here is the relevant code:

# OBS_REQUEST_CLIENT, TEXT_SOURCE_NAME, text_item_id, and text are all assigned before this point
OBS_REQUEST_CLIENT.set_input_settings(TEXT_SOURCE_NAME, {"text": text}, True)

text_item_transform = OBS_REQUEST_CLIENT.get_scene_item_transform("Scene", text_item_id).scene_item_transform

text_item_width = text_item_transform["sourceWidth"]
text_item_height = text_item_transform["sourceHeight"]

OBS_REQUEST_CLIENT.set_scene_item_transform(
    "Scene",
    text_item_id,
    {
        "scaleX": 1.0,
        "scaleY": 1.0,
        "positionX": (SCENE_WIDTH - text_item_width) / 2,
        "positionY": (SCENE_HEIGHT - text_item_height) / 2,
    }
)

However, having these two calls one after the other often results in stale data for the text item's width and height. I have to put a sleep(0.1) call after the call to OBS_REQUEST_CLIENT.set_input_settings(...) to prevent this. This does not seem like expected behavior unless I am mistaken.

Error in set_scene_item_index request

def set_scene_item_index(self, scene_name, item_id, item_index):
"""
Sets the index position of a scene item in a scene.
Scenes and Groups
:param scene_name: Name of the scene the item is in
:type scene_name: str
:param item_id: Numeric ID of the scene item (>= 0)
:type item_id: int
:param item_index: New index position of the scene item (>= 0)
:type item_index: int
"""
payload = {
"sceneName": scene_name,
"sceneItemId": item_id,
"sceneItemLocked": item_index, <--- this should be sceneItemIndex
}
self.send("SetSceneItemIndex", payload)

Adding timeout to obsws_python.EventClient() causes timeout even when connection is ok

Hi!

Thanks for your package! It's been a pleasure to work with it. Things are simple enough yet powerful as the obsws is. I think I might have found something tiny, though. Most prolly the prob is in my end but decided to report this anyway.

I accidentally added timeout to my EventClient call, which seemed to cause weird timeout error regardless if the connection was made or not. I got a timeout error on Python side but the connection showed up in the OBS WS window in OBS. ReqClient works fine with or without timeout.

Not putting anything on the timeout argument fixed the problem.

Whether ReqClient is made or not doesn't have an effect on the outcome.

Here's the versions, code and error message

Happy holidays and/or new year!

Issue originally raised by @jussikiova

Trouble Getting Recording File Name

I am sure this is a user error rather than a bug as such, but I am trying to get the file name of a recording, either before start, on start, during recording, on stop or after stop, I dont mind.

Appreciate the tool and help.

import obsstudio_sdk as obs
import time

# load conn info from config.toml
cl = obs.ReqClient()

start = cl.start_record()
#print(start.attrs())

time.sleep(4)

stop = cl.stop_record()
print(stop.attrs())

myfile = cl.get_record_state_changed()
print(myfile.attrs())

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.