Re-work readiness notifications for non-operators (#607)

This commit is contained in:
Etoh 2023-05-20 15:35:57 +01:00
parent b62b038cdf
commit 8772c5ea51
2 changed files with 30 additions and 11 deletions

View File

@ -1,5 +1,5 @@
version = '1.7.0' version = '1.7.0'
revision = '' revision = ''
milestone = 'Yoitsu' milestone = 'Yoitsu'
release_number = '105' release_number = '106'
projectURL = 'https://syncplay.pl/' projectURL = 'https://syncplay.pl/'

View File

@ -1186,10 +1186,10 @@ class SyncplayClient(object):
return return
if self._client.getPlayerPaused() or not self._userlist.currentUser.isReady(): if self._client.getPlayerPaused() or not self._userlist.currentUser.isReady():
self._warnings["not-all-ready"]["displayedFor"] = 0 self._warnings["not-all-ready"]["displayedFor"] = 0
if self._userlist.areYouAloneInRoom() or not self._userlist.currentUser.canControl(): if self._userlist.areYouAloneInRoom():
if self._warnings["not-all-ready"]['timer'].running: if self._warnings["not-all-ready"]['timer'].running:
self._warnings["not-all-ready"]['timer'].stop() self._warnings["not-all-ready"]['timer'].stop()
elif not self._userlist.areAllUsersInRoomReady(): elif not self._userlist.areAllRelevantUsersInRoomReady():
self._displayReadySameWarning() self._displayReadySameWarning()
if constants.SHOW_OSD_WARNINGS and not self._warnings["not-all-ready"]['timer'].running: if constants.SHOW_OSD_WARNINGS and not self._warnings["not-all-ready"]['timer'].running:
self._warnings["not-all-ready"]['timer'].start(constants.WARNING_OSD_MESSAGES_LOOP_INTERVAL, True) self._warnings["not-all-ready"]['timer'].start(constants.WARNING_OSD_MESSAGES_LOOP_INTERVAL, True)
@ -1450,9 +1450,28 @@ class SyncplayUserlist(object):
user = self._users[username] user = self._users[username]
user.setControllerStatus(True) user.setControllerStatus(True)
def areAllRelevantUsersInRoomReady(self, requireSameFilenames=False):
if not self.currentUser.isReady():
return False
if self.currentUser.canControl():
return self.areAllUsersInRoomReady(requireSameFilenames)
else:
for user in self._users.values():
if user.room == self.currentUser.room and user.canControl():
if user.isReadyWithFile() == False:
return False
elif (
requireSameFilenames and
(
self.currentUser.file is None
or user.file is None
or not utils.sameFilename(self.currentUser.file['name'], user.file['name'])
)
):
return False
return True
def areAllUsersInRoomReady(self, requireSameFilenames=False): def areAllUsersInRoomReady(self, requireSameFilenames=False):
if not self.currentUser.canControl():
return True
if not self.currentUser.isReady(): if not self.currentUser.isReady():
return False return False
for user in self._users.values(): for user in self._users.values():
@ -1460,12 +1479,12 @@ class SyncplayUserlist(object):
if user.isReadyWithFile() == False: if user.isReadyWithFile() == False:
return False return False
elif ( elif (
requireSameFilenames and requireSameFilenames and
( (
self.currentUser.file is None self.currentUser.file is None
or user.file is None or user.file is None
or not utils.sameFilename(self.currentUser.file['name'], user.file['name']) or not utils.sameFilename(self.currentUser.file['name'], user.file['name'])
) )
): ):
return False return False
return True return True