MCPcopy
hub / github.com/xfangfang/Macast / send_command

Method send_command

macast_renderer/mpv.py:209–226  ·  view source on GitHub ↗

Sending command to mpv

(self, command)

Source from the content-addressed store, hash-verified

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

Callers 11

set_media_stopMethod · 0.95
set_media_pauseMethod · 0.95
set_media_resumeMethod · 0.95
set_media_volumeMethod · 0.95
set_media_muteMethod · 0.95
set_media_urlMethod · 0.95
set_media_titleMethod · 0.95
set_media_positionMethod · 0.95
set_observeMethod · 0.95
stopMethod · 0.95
loadfileMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected