comparison src/plugins/plugin_misc_radiocol.py @ 825:e3f4d80f987d

plugins room_games, radiocol: better synchronization after a user joins a running game
author souliane <souliane@mailoo.org>
date Wed, 15 Jan 2014 23:01:23 +0100
parents 1fe00f0c9a91
children 71f8e996f765
comparison
equal deleted inserted replaced
824:c304ce32042b 825:e3f4d80f987d
222 radio_data['playing'] = True 222 radio_data['playing'] = True
223 self.playNext(room_jid, profile) 223 self.playNext(room_jid, profile)
224 else: 224 else:
225 error(_('Unmanaged game element: %s') % elt.name) 225 error(_('Unmanaged game element: %s') % elt.name)
226 226
227 def getSyncData(self, room_jid_s): 227 def getSyncData(self, room_jid_s, force_nicks=[]):
228 data = self.games[room_jid_s]['queue'] 228 data = {}
229 if len(data) == QUEUE_LIMIT: 229 status = self.games[room_jid_s]['status']
230 data.append(domish.Element((None, 'no_upload'))) 230 nicks = [nick for nick in status if status[nick] == 'desync']
231 for nick in force_nicks:
232 if nick not in nicks:
233 nicks.append(nick)
234 for nick in nicks:
235 if len(self.games[room_jid_s]['queue']) > 0:
236 data[nick] = copy.deepcopy(self.games[room_jid_s]['queue'])
237 if len(self.games[room_jid_s]['queue']) == QUEUE_LIMIT:
238 data[nick].append(domish.Element(('', 'no_upload')))
231 return data 239 return data