How to use the pywebostv.connection.WebOSClient function in pywebostv

To help you get started, we’ve selected a few pywebostv examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github supersaiyanmode / PyWebOSTV / tests / test_controls.py View on Github external
def test_unmute(self):
        client = WebOSClient("ws://a")
        media = MediaControl(client)
        media.mute(False)

        self.assert_sent_message_without_id({
            "type": "request",
            "uri": "ssap://audio/setMute",
            "payload": {"mute": False}
        })
github supersaiyanmode / PyWebOSTV / tests / test_controls.py View on Github external
def set_volume(self):
        client = WebOSClient("ws://a")
        media = MediaControl(client)
        media.set_volume(30)

        self.assert_sent_message_without_id({
            "type": "request",
            "uri": "ssap://audio/setVolume",
            "payload": {"volume": 30}
        })
github supersaiyanmode / PyWebOSTV / tests / test_controls.py View on Github external
def test_mute(self):
        client = WebOSClient("ws://a")
        media = MediaControl(client)
        media.mute(True)

        self.assert_sent_message_without_id({
            "type": "request",
            "uri": "ssap://audio/setMute",
            "payload": {"mute": True}
        })
github supersaiyanmode / PyWebOSTV / tests / test_controls.py View on Github external
def test_volume_down(self):
        client = WebOSClient("ws://a")
        media = MediaControl(client)
        media.volume_down()

        self.assert_sent_message_without_id({
            "type": "request",
            "uri": "ssap://audio/volumeDown"
        })
github supersaiyanmode / PyWebOSTV / pywebostv / connection.py View on Github external
if get_queue:
            wait_queue = Queue()
            callback = wait_queue.put

        if callback is not None:
            with self.waiter_lock:
                self.waiters[unique_id] = (callback, cur_time())

        obj = {"type": request_type, "id": unique_id}
        if uri is not None:
            obj["uri"] = uri
        if payload is not None:
            obj["payload"] = payload

        with self.send_lock:
            super(WebOSClient, self).send(json.dumps(obj))

        if get_queue:
            return wait_queue
github grimpy / koditools / koditools / plugins / lgtv.py View on Github external
def __init__(self, ip, key=None):
        self.store = {}
        if key:
            self.store['client_key'] = key
        self.ip = ip
        self.client = WebOSClient(ip)
        self.connnected = False
        self.clients = {}
github supersaiyanmode / PyWebOSTV / pywebostv / connection.py View on Github external
def discover():
        res = discover("urn:schemas-upnp-org:device:MediaRenderer:1",
                       keyword="LG", hosts=True, retries=3)
        return [WebOSClient(x) for x in res]