mirror of
https://github.com/onyx-and-iris/obsws-python.git
synced 2024-11-22 04:40:53 +00:00
Merge pull request #20 from onyx-and-iris/dev
add conn info to __repr__ methods, lower required python ver to 3.9 + other small changes
This commit is contained in:
commit
ef0f770c0c
@ -5,7 +5,6 @@
|
||||
|
||||
# A Python SDK for OBS Studio WebSocket v5.0
|
||||
|
||||
This is a wrapper around OBS Websocket.
|
||||
Not all endpoints in the official documentation are implemented.
|
||||
|
||||
## Requirements
|
||||
@ -13,7 +12,7 @@ Not all endpoints in the official documentation are implemented.
|
||||
- [OBS Studio](https://obsproject.com/)
|
||||
- [OBS Websocket v5 Plugin](https://github.com/obsproject/obs-websocket/releases/tag/5.0.0)
|
||||
- With the release of OBS Studio version 28, Websocket plugin is included by default. But it should be manually installed for earlier versions of OBS.
|
||||
- Python 3.10 or greater
|
||||
- Python 3.9 or greater
|
||||
|
||||
### How to install using pip
|
||||
|
||||
@ -27,7 +26,7 @@ By default the clients connect with parameters:
|
||||
|
||||
- `host`: "localhost"
|
||||
- `port`: 4455
|
||||
- `password`: None
|
||||
- `password`: ""
|
||||
|
||||
You may override these parameters by storing them in a toml config file or passing them as keyword arguments.
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
from .enum import Subs
|
||||
from .events import EventClient
|
||||
from .reqs import ReqClient
|
||||
from .subs import Subs
|
||||
from .version import version as __version__
|
||||
|
||||
__ALL__ = ["ReqClient", "EventClient", "Subs"]
|
||||
|
@ -14,7 +14,7 @@ class ObsClient:
|
||||
logger = logging.getLogger("baseclient.obsclient")
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
defaultkwargs = {"host": "localhost", "port": 4455, "password": None, "subs": 0}
|
||||
defaultkwargs = {"host": "localhost", "port": 4455, "password": "", "subs": 0}
|
||||
if not any(key in kwargs for key in ("host", "port", "password")):
|
||||
kwargs |= self._conn_from_toml()
|
||||
kwargs = defaultkwargs | kwargs
|
||||
@ -22,7 +22,7 @@ class ObsClient:
|
||||
setattr(self, attr, val)
|
||||
|
||||
self.logger.info(
|
||||
"Connecting with parameters: {host} {port} {password} {subs}".format(
|
||||
"Connecting with parameters: host='{host}' port={port} password='{password}' subs={subs}".format(
|
||||
**self.__dict__
|
||||
)
|
||||
)
|
||||
|
@ -5,7 +5,7 @@ from threading import Thread
|
||||
|
||||
from .baseclient import ObsClient
|
||||
from .callback import Callback
|
||||
from .enum import Subs
|
||||
from .subs import Subs
|
||||
|
||||
"""
|
||||
A class to interact with obs-websocket events
|
||||
@ -28,6 +28,13 @@ class EventClient:
|
||||
self.subscribe()
|
||||
|
||||
def __repr__(self):
|
||||
return type(
|
||||
self
|
||||
).__name__ + "(host='{host}', port={port}, password='{password}', subs={subs})".format(
|
||||
**self.base_client.__dict__,
|
||||
)
|
||||
|
||||
def __str__(self):
|
||||
return type(self).__name__
|
||||
|
||||
def subscribe(self):
|
||||
|
@ -26,6 +26,13 @@ class ReqClient:
|
||||
self.base_client.ws.close()
|
||||
|
||||
def __repr__(self):
|
||||
return type(
|
||||
self
|
||||
).__name__ + "(host='{host}', port={port}, password='{password}')".format(
|
||||
**self.base_client.__dict__,
|
||||
)
|
||||
|
||||
def __str__(self):
|
||||
return type(self).__name__
|
||||
|
||||
def send(self, param, data=None, raw=False):
|
||||
|
@ -1 +1 @@
|
||||
version = "1.3.0"
|
||||
version = "1.4.0"
|
||||
|
@ -8,7 +8,7 @@ dynamic = ["version"]
|
||||
description = "A Python SDK for OBS Studio WebSocket v5.0"
|
||||
readme = "README.md"
|
||||
license = "GPL-3.0-only"
|
||||
requires-python = ">=3.10"
|
||||
requires-python = ">=3.9"
|
||||
authors = [
|
||||
{ name = "Adem Atikturk", email = "aatikturk@gmail.com" },
|
||||
]
|
||||
@ -37,7 +37,18 @@ include = [
|
||||
]
|
||||
|
||||
[tool.hatch.envs.e.scripts]
|
||||
events = "py {root}\\examples\\events\\."
|
||||
hotkeys = "py {root}\\examples\\hotkeys\\."
|
||||
levels = "py {root}\\examples\\levels\\."
|
||||
scene_rotate = "py {root}\\examples\\scene_rotate\\."
|
||||
events = "python {root}\\examples\\events\\."
|
||||
hotkeys = "python {root}\\examples\\hotkeys\\."
|
||||
levels = "python {root}\\examples\\levels\\."
|
||||
scene_rotate = "python {root}\\examples\\scene_rotate\\."
|
||||
|
||||
[tool.hatch.envs.test]
|
||||
dependencies = [
|
||||
"pytest",
|
||||
]
|
||||
|
||||
[tool.hatch.envs.test.scripts]
|
||||
run = 'pytest -v'
|
||||
|
||||
[[tool.hatch.envs.test.matrix]]
|
||||
python = ["39", "310", "311"]
|
||||
|
2
setup.py
2
setup.py
@ -40,7 +40,7 @@ EXTRAS_REQUIRE = {
|
||||
}
|
||||
|
||||
# Python version requirement
|
||||
PYTHON_REQUIRES = ">=3.10"
|
||||
PYTHON_REQUIRES = ">=3.9"
|
||||
|
||||
setup(
|
||||
name=PACKAGE_NAME,
|
||||
|
@ -13,4 +13,7 @@ def teardown_module():
|
||||
req_cl.remove_scene("START_TEST")
|
||||
req_cl.remove_scene("BRB_TEST")
|
||||
req_cl.remove_scene("END_TEST")
|
||||
resp = req_cl.get_studio_mode_enabled()
|
||||
if resp.studio_mode_enabled:
|
||||
req_cl.set_studio_mode_enabled(False)
|
||||
req_cl.base_client.ws.close()
|
||||
|
Loading…
Reference in New Issue
Block a user