MCPcopy Index your code
hub / github.com/Syncplay/syncplay / sendState

Method sendState

syncplay/protocols.py:294–318  ·  view source on GitHub ↗
(self, position, paused, doSeek, latencyCalculation, stateChange=False)

Source from the content-addressed store, hash-verified

292 self.sendState(position, paused, doSeek, latencyCalculation, stateChange)
293
294 def sendState(self, position, paused, doSeek, latencyCalculation, stateChange=False):
295 state = {}
296 positionAndPausedIsSet = position is not None and paused is not None
297 clientIgnoreIsNotSet = self.clientIgnoringOnTheFly == 0 or self.serverIgnoringOnTheFly != 0
298 if clientIgnoreIsNotSet and positionAndPausedIsSet:
299 state["playstate"] = {}
300 state["playstate"]["position"] = position
301 state["playstate"]["paused"] = paused
302 if doSeek:
303 state["playstate"]["doSeek"] = doSeek
304 state["ping"] = {}
305 if latencyCalculation:
306 state["ping"]["latencyCalculation"] = latencyCalculation
307 state["ping"]["clientLatencyCalculation"] = self._pingService.newTimestamp()
308 state["ping"]["clientRtt"] = self._pingService.getRtt()
309 if stateChange:
310 self.clientIgnoringOnTheFly += 1
311 if self.serverIgnoringOnTheFly or self.clientIgnoringOnTheFly:
312 state["ignoringOnTheFly"] = {}
313 if self.serverIgnoringOnTheFly:
314 state["ignoringOnTheFly"]["server"] = self.serverIgnoringOnTheFly
315 self.serverIgnoringOnTheFly = 0
316 if self.clientIgnoringOnTheFly:
317 state["ignoringOnTheFly"]["client"] = self.clientIgnoringOnTheFly
318 self.sendMessage({"State": state})
319
320 def requestControlledRoom(self, room, password):
321 self.sendSet({

Callers 1

handleStateMethod · 0.95

Calls 3

newTimestampMethod · 0.80
getRttMethod · 0.80
sendMessageMethod · 0.80

Tested by

no test coverage detected