Exemplo n.º 1
0
 def getMusicData(self, phase, filename):
     data = []
     phase = sanitizePhase(phase)
     phase = self.phaseToMusicData.get(phase)
     if phase:
         data = phase.get(filename, [])
     return data
 def getMusicData(self, phase, filename):
     data = []
     phase = sanitizePhase(phase)
     phase = self.phaseToMusicData.get(phase)
     if phase:
         data = phase.get(filename, [])
     return data
    def setSongPlaying(self, songInfo, toonId):
        """
        Sets the song from the AI to play in the client.
        Parameters:
            songInfo is a list with two items: phase and filename
        """

        phase = sanitizePhase(songInfo[0])
        filename = songInfo[1]
        assert (self.notify.debug("setSongPlaying phase_%d/%s" %
                                  (phase, filename)))

        # setSongPlaying sends empty filename if songs have stop playing
        # in order for the client to clean up.
        if not filename:
            self.__stop()
            return

        data = self.getMusicData(phase, filename)
        if data:
            self.__play(phase, filename, data[1])
            self.setSignNote(data[0])

            # Update the gui if it's active:
            if self.gui.isLoaded():
                item = self.gui.popSongFromQueue()
                self.gui.setSongCurrentlyPlaying(phase, filename)

                if item == self.localQueuedSongListItem:
                    self.__localClearQueuedSong()

        if toonId == localAvatar.doId:
            localAvatar.setSystemMessage(0, TTLocalizer.PartyJukeboxNowPlaying)
 def __addSongToQueue(self, songInfo, isLocalQueue=False):
     isHost = isLocalQueue and self.isUserHost()
     data = self.getMusicData(sanitizePhase(songInfo[0]), songInfo[1])
     if data:
         listItem = self.gui.addSongToQueue(data[0], highlight=isLocalQueue, moveToTopButton=isHost)
         if isLocalQueue:
             self.localQueuedSongInfo = songInfo
             self.localQueuedSongListItem = listItem
Exemplo n.º 5
0
 def __addSongToQueue(self, songInfo, isLocalQueue = False):
     isHost = isLocalQueue and self.isUserHost()
     data = self.getMusicData(sanitizePhase(songInfo[0]), songInfo[1])
     if data:
         listItem = self.gui.addSongToQueue(data[0], highlight=isLocalQueue, moveToTopButton=isHost)
         if isLocalQueue:
             self.localQueuedSongInfo = songInfo
             self.localQueuedSongListItem = listItem
 def setSongInQueue(self, songInfo):
     if self.gui.isLoaded():
         phase = sanitizePhase(songInfo[0])
         filename = songInfo[1]
         data = self.getMusicData(phase, filename)
         if data:
             if self.localQueuedSongListItem is not None:
                 self.localQueuedSongListItem['text'] = data[0]
             else:
                 self.__addSongToQueue(songInfo, isLocalQueue=True)
 def setSongInQueue(self, songInfo):
     if self.gui.isLoaded():
         phase = sanitizePhase(songInfo[0])
         filename = songInfo[1]
         data = self.getMusicData(phase, filename)
         if data:
             if self.localQueuedSongListItem is not None:
                 self.localQueuedSongListItem['text'] = data[0]
             else:
                 self.__addSongToQueue(songInfo, isLocalQueue=True)
 def _DistributedPartyJukeboxActivityBase__addSongToQueue(self, songInfo, isLocalQueue = False):
     if isLocalQueue:
         pass
     isHost = self.isUserHost()
     data = self.getMusicData(sanitizePhase(songInfo[0]), songInfo[1])
     if data:
         listItem = self.gui.addSongToQueue(data[0], highlight = isLocalQueue, moveToTopButton = isHost)
         if isLocalQueue:
             self.localQueuedSongInfo = songInfo
             self.localQueuedSongListItem = listItem
 def setSongPlaying(self, songInfo, toonId):
     phase = sanitizePhase(songInfo[0])
     filename = songInfo[1]
     if not filename:
         self.__stop()
         return
     data = self.getMusicData(phase, filename)
     if data:
         self.__play(phase, filename, data[1])
         self.setSignNote(data[0])
         if self.gui.isLoaded():
             item = self.gui.popSongFromQueue()
             self.gui.setSongCurrentlyPlaying(phase, filename)
             if item == self.localQueuedSongListItem:
                 self.__localClearQueuedSong()
     if toonId == localAvatar.doId:
         localAvatar.setSystemMessage(0, TTLocalizer.PartyJukeboxNowPlaying)
Exemplo n.º 10
0
 def setSongPlaying(self, songInfo, toonId):
     phase = sanitizePhase(songInfo[0])
     filename = songInfo[1]
     if not filename:
         self.__stop()
         return
     data = self.getMusicData(phase, filename)
     if data:
         self.__play(phase, filename, data[1])
         self.setSignNote(data[0])
         if self.gui.isLoaded():
             item = self.gui.popSongFromQueue()
             self.gui.setSongCurrentlyPlaying(phase, filename)
             if item == self.localQueuedSongListItem:
                 self.__localClearQueuedSong()
     if toonId == localAvatar.doId:
         localAvatar.setSystemMessage(0, TTLocalizer.PartyJukeboxNowPlaying)
    def __addSongToQueue(self, songInfo, isLocalQueue=False):
        """
        Adds a song to the queue. If it's the localAvatar's queued song, then
        it marks it.
        
        Parameters:
            songInfo is a list of phase and data
            isLocalQueue is flag marking whether this is the localAvatar's queued song
        """
        isHost = (isLocalQueue and self.isUserHost())

        data = self.getMusicData(sanitizePhase(songInfo[0]), songInfo[1])
        if data:
            listItem = self.gui.addSongToQueue(data[0],
                                               highlight=isLocalQueue,
                                               moveToTopButton=isHost)
            if isLocalQueue:
                self.localQueuedSongInfo = songInfo
                self.localQueuedSongListItem = listItem