Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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}
})
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}
})
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}
})
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"
})
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
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 = {}
def discover():
res = discover("urn:schemas-upnp-org:device:MediaRenderer:1",
keyword="LG", hosts=True, retries=3)
return [WebOSClient(x) for x in res]