jath03 / openrgb-python

A python client for the OpenRGB SDK
GNU General Public License v3.0
112 stars 22 forks source link

Autostart server #62

Closed eadmaster closed 2 years ago

eadmaster commented 2 years ago

add an option to autostart the server if not running when creating a client istance.

Avoid errors like this: https://www.reddit.com/r/OpenRGB/comments/vg6az5/connection_refused_in_openrgbpython/

jath03 commented 2 years ago

I don't know how you imagine this being implemented without somehow bundling an instance of openrgb with the library. If you want to try and start the server yourself if it isn't on, then you can try something like:

try:
    cli = OpenRGBClient()
except OSError:
    subprocess.Popen("/path/to/openrgb --server", shell=True)
    time.sleep(5) # letting detection run
    cli = OpenRGBClient()

I don't think starting OpenRGB itself is within the scope of this library. Also, I don't see how this functionality would have avoided that error because the issue was with flatpak permissions.

Feel free to correct me if I'm misunderstanding something, but meanwhile, I'm going to close this.