Sending command to mpv
(self, command)
| 207 | logger.debug(res) |
| 208 | |
| 209 | def send_command(self, command): |
| 210 | """Sending command to mpv |
| 211 | """ |
| 212 | logger.debug("send command: " + str(command)) |
| 213 | data = {"command": command} |
| 214 | msg = json.dumps(data) + '\n' |
| 215 | try: |
| 216 | self.command_lock.acquire() |
| 217 | if os.name == 'nt': |
| 218 | self.ipc_sock.send_bytes(msg.encode()) |
| 219 | else: |
| 220 | self.ipc_sock.sendall(msg.encode()) |
| 221 | return True |
| 222 | except Exception as e: |
| 223 | logger.error('sendCommand: ' + str(e)) |
| 224 | return False |
| 225 | finally: |
| 226 | self.command_lock.release() |
| 227 | |
| 228 | def start_ipc(self): |
| 229 | """Start ipc thread |
no outgoing calls
no test coverage detected