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

Method updatePlayerStatus

syncplay/client.py:229–259  ·  view source on GitHub ↗
(self, paused, position)

Source from the content-addressed store, hash-verified

227 return self.isPlayingMusic() and self._recentlyAdvanced()
228
229 def updatePlayerStatus(self, paused, position):
230 position -= self.getUserOffset()
231 pauseChange, seeked = self._determinePlayerStateChange(paused, position)
232 positionBeforeSeek = self._playerPosition
233 self._playerPosition = position
234 self._playerPaused = paused
235 currentLength = self.userlist.currentUser.file["duration"] if self.userlist.currentUser.file else 0
236 if (
237 pauseChange and paused and currentLength > constants.PLAYLIST_LOAD_NEXT_FILE_MINIMUM_LENGTH
238 and abs(position - currentLength) < constants.PLAYLIST_LOAD_NEXT_FILE_TIME_FROM_END_THRESHOLD
239 ):
240 self.playlist.advancePlaylistCheck()
241 elif pauseChange and "readiness" in self.serverFeatures and self.serverFeatures["readiness"]:
242 if (
243 currentLength == 0 or currentLength == -1 or
244 not (
245 not self.playlist.notJustChangedPlaylist() and
246 abs(position - currentLength) < constants.PLAYLIST_LOAD_NEXT_FILE_TIME_FROM_END_THRESHOLD
247 )
248 ):
249 pauseChange = self._toggleReady(pauseChange, paused)
250
251 if self._lastGlobalUpdate:
252 self._lastPlayerUpdate = time.time()
253 if (pauseChange or seeked) and self._protocol:
254 if self.recentlyRewound() or self._recentlyAdvanced():
255 self._protocol.sendState(self._globalPosition, self.getPlayerPaused(), False, None, True)
256 return
257 if seeked:
258 self.playerPositionBeforeLastSeek = self.getGlobalPosition()
259 self._protocol.sendState(self.getPlayerPosition(), self.getPlayerPaused(), seeked, None, True)
260
261 def prepareToChangeToNewPlaylistItemAndRewind(self):
262 self.ui.showDebugMessage("Preparing to change to new playlist index and rewind...")

Callers 5

askForStatusMethod · 0.80
askForStatusMethod · 0.80
askForStatusMethod · 0.80
askForStatusMethod · 0.80
__echoGlobalStatusMethod · 0.80

Calls 11

getUserOffsetMethod · 0.95
_toggleReadyMethod · 0.95
recentlyRewoundMethod · 0.95
_recentlyAdvancedMethod · 0.95
getPlayerPausedMethod · 0.95
getGlobalPositionMethod · 0.95
getPlayerPositionMethod · 0.95
advancePlaylistCheckMethod · 0.80
sendStateMethod · 0.45

Tested by

no test coverage detected