Git Product home page Git Product logo

pyslobs's Issues

StreamLabs OBS changed name to StreamLabs Desktop

References should be updated.

Possible steps, in order of priority:

  1. Change the documentation/comments to refer to the new name.
  2. Refactor the internal classes with new names (which won't affect the API). Not much value here.
  3. Rename the public classes to use SLD instead of SLOBS. Include aliases from old names to make transition seamless.
    4: Rename the whole package in PyPI?

The later steps don't look like they will be worth the effort - happy to hear opinions.

AuthenticationFailure

This module will be very meaningful to me.
Thank you in advance.

I get an error with the following code.

File "D:\twitchbot\.venv\lib\site-packages\pyslobs\connection.py", line 104, in _authenticate
    raise AuthenticationFailure("%s" % response)
pyslobs.connection.AuthenticationFailure: {'id': 'auth_request', 'jsonrpc': '2.0', 'error': {'code': -32603, 'message': 'INTERNAL_JSON_RPC_ERROR Invalid token'}}

What kind of authentication is this supposed to be failing?

I've also included the ini file.

{pyslobs.ini}

[connection]
domain=localhost
port=59650
token=QRcode's APITOKEN

Sorry for my poor English.

Python 3.9 required for Typing

When I try to import SlobsConnection, I have an error with AudioService.

  File "myscript.py", line 4, in <module>
    from pyslobs import SlobsConnection
  File "D:\Apps\Python\Python38-32\lib\site-packages\pyslobs\__init__.py", line 3, in <module>
    from .slobs.audioservice import AudioService
  File "D:\Apps\Python\Python38-32\lib\site-packages\pyslobs\slobs\audioservice.py", line 8, in <module>
    class AudioService(SlobsService):
  File "D:\Apps\Python\Python38-32\lib\site-packages\pyslobs\slobs\audioservice.py", line 18, in AudioService
    async def get_sources(self) -> list[AudioSource]:
TypeError: 'type' object is not subscriptable

Else, thanks for work. :)

SceneNode.set_visibility does not update cached visibility.

SceneItem has some "attributes" (Python properties) recording_visible, stream_visible and visible. These are not used by PySlobs, but are local cache values to reduce the need for clients to have to refetch objects. (They can be out-of-date!)

SceneNode.set_settings() modifies a the visibility of a scene_node, and correctly updates the local cache values. It is exercised in ex_scenenodes.py.

SceneNode.set_visbility() also modifies a the visibility of a scene_node. It does NOT updates the local cache values. It is NOT exercised.

It should have the line self._visible = visible, and it should be exercised to show it works correctly.

Is it possible to change the visibility of sources?

Hi,

i was wondering if there is an option to set the visibility of sources in a scene. I animated a little overlay for a game, which should be visible when ingame and invisible when i'm in the main menu. I searched throught the sourcesservice.py and source.py files to find a method which does that, but i could not find anything. I also tried to set every "visible" option in the properties to false and then update the source properties with "set_properties_form_data", but that did'nt work either, the settings were updated but the overlay was still visible. Can you help me out with that?
Thanks

Can I control someone else's OBS?

I'm sorry for asking personal questions again.
I'm thinking of getting someone else's API token to control it.
Is this technically possible?
If you could do that, what do you think you would need?

Thank you in advance!

ERROR:slobsapi.SlobsConnection:_receive_and_dispatch failing.

ERROR:slobsapi.SlobsConnection:_receive_and_dispatch failing.
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/pyslobs/connection.py", line 209, in _receive_and_dispatch
message = await self._receive_message()
File "/usr/local/lib/python3.10/site-packages/pyslobs/connection.py", line 197, in _receive_message
return await loop.run_in_executor(None, self.websocket.receive_message)
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.10/site-packages/pyslobs/connection.py", line 65, in receive_message
raw_message = self.socket.recv()
File "/usr/local/lib/python3.10/site-packages/websocket/_core.py", line 362, in recv
opcode, data = self.recv_data()
File "/usr/local/lib/python3.10/site-packages/websocket/_core.py", line 385, in recv_data
opcode, frame = self.recv_data_frame(control_frame)
File "/usr/local/lib/python3.10/site-packages/websocket/_core.py", line 406, in recv_data_frame
frame = self.recv_frame()
File "/usr/local/lib/python3.10/site-packages/websocket/_core.py", line 445, in recv_frame
return self.frame_buffer.recv_frame()
File "/usr/local/lib/python3.10/site-packages/websocket/_abnf.py", line 338, in recv_frame
self.recv_header()
File "/usr/local/lib/python3.10/site-packages/websocket/_abnf.py", line 294, in recv_header
header = self.recv_strict(2)
File "/usr/local/lib/python3.10/site-packages/websocket/abnf.py", line 373, in recv_strict
bytes
= self.recv(min(16384, shortage))
File "/usr/local/lib/python3.10/site-packages/websocket/_core.py", line 529, in _recv
return recv(self.sock, bufsize)
File "/usr/local/lib/python3.10/site-packages/websocket/_socket.py", line 122, in recv
raise WebSocketConnectionClosedException(
websocket._exceptions.WebSocketConnectionClosedException: Connection to remote host was lost.
Error occurred: Connection to remote host was lost.

Should be able to close a SlobsConnection without an async loop.

I found that I wanted to create a SlobsConnection, launch a background thread to handle the background connection, and then close the connection.

Investigating this revealed several areas that could be improved:

  1. close() can be changed from an co-routine to a regular method. This is a minor change to the API, but it is a breaking change. Looks like it is time for v2.0.0!

  2. Clean-up should occur even if an unexpected exception is raised in receive_and_dispatch

  3. If the background task terminates, the logging should always show why.

  4. If the connection is already closed, calling methods on it should fail with ProtocolError

  5. References to clean-up tasks are not being kept, leaving a risk that they would be garbage-collected before completion.

I want to play the video I've made during the live broadcast.

I apologize for raising this issue for very personal reasons...
My guess is to do get_scene to get the name of the scene and then create_source.
For now,I used list_all_scenes made by examples to get the name.
What should I do from here?

async def createing_sources(conn):
    list_all_scenes(conn)
    ss = SourcesService(conn)
    scene = await ss.create_source()
    ??

Thank you in advance.

StreamLabs sends message without id or result field

SlobsConnection._receive_and_dispatch receives messages from StreamLabs Desktop, and assumes they have an id field (as a response to a request) or a result field, in response to a subscription.

While I was streaming, it got a response which did not contain either, causing a log message:

_receive_and_dispatch failing.
Traceback (most recent call last):
  File "[omitted]\pyslobs\connection.py", line 192, in _receive_and_dispatch
    key = message["result"]["resourceId"]
KeyError: 'result'

Whatever this message is, it should be handled.

Sceneitem_factory wrong return

Hey, i've noticed that the transform_postition of an Item is wrong.

instead of excpected something like:
IVec2(x=50, y=0) (with two integers, one as x and one as y)

it was:

IVec2(x='x', y='y')

Strings instead of the actual parameters in the tuple.

The problem is in the sceneitem_factory (factories.py line 33)

The faulty part is the else:
instead of this:

def sceneitem_factory(connection, json_dict):
    # We see inconsistency in choices of API here.
    if isinstance(json_dict["transform"]["position"], list):
        transform_position = (
            IVec2(
                x=json_dict["transform"]["position"][0],
                y=json_dict["transform"]["position"][1],
            ),
        )
    else:
        transform_position = IVec2(*json_dict["transform"]["position"])

It should be that:

def sceneitem_factory(connection, json_dict):
    # We see inconsistency in choices of API here.
    if isinstance(json_dict["transform"]["position"], list):
        transform_position = (
            IVec2(
                x=json_dict["transform"]["position"][0],
                y=json_dict["transform"]["position"][1],
            ),
        )
    else:
        transform_position = (
            IVec2(
                x=json_dict["transform"]["position"]['x'] ,
                y=json_dict["transform"]["position"]['y'] ,
            )
        )

Should i create a PR for that?

Use of id_ inconsistent.

Background:

The API has many references to "id" fields. id() is a built-in function in Python, and PySLOBS avoids using it directly to avoid warnings that the built-in is being hidden.

Private fields in a record are consistently called _id.
Method parameters are consistently called id_.

The properties fields are inconsistent though: They are called id in Scene and Source (and in test code), but they are called id_ in SceneNode (and its subclasses).

Whichever decision is made, make the properties all consistent.

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.