def update(self): # Calculate the time step now = time.time() dt = now - self.lastTime self.lastTime = now # Get the current song title title = str(xmms.get_playlist_title(xmms.get_playlist_pos())) if len(title) > self.vfd.width: # Scroll it around so we can see the whole thing. At the beginning # of the scroll cycle it delays by scrollerDelay scroll cycles, # and there is a scrollerGap character gap between copies of the scrolled title. if title != self.lastTitle: self.scrollerIndex = -self.scrollerDelay self.lastTitle = title if self.scrollerIndex >= 1: self.scrollerIndex %= self.scrollerGap + len(title) if self.scrollerIndex < 1: self.scrollerIndex = -self.scrollerDelay else: title = ("%s%s%s" % (title, " " * self.scrollerGap, title))[int(self.scrollerIndex):] self.scrollerIndex += dt * self.scrollSpeed # get the current time index if xmms.is_playing(): millisec = xmms.get_output_time() minutes = millisec / 60000 seconds = (millisec % 60000) / 1000.0 playTime = "%3d:%05.2f" % (minutes, seconds) else: playTime = " --:--.--" if xmms.is_paused(): spinner = self.spinnerPaused elif xmms.is_playing(): self.spinnerIndex %= len(self.spinnerPlaying) spinner = self.spinnerPlaying[int(self.spinnerIndex)] self.spinnerIndex += dt * self.spinnerSpeed else: spinner = self.spinnerIdle # Clock with a flashing colon self.colonIndex += dt * 3 self.colonIndex %= 2 clock = time.strftime("%%H%s%%M" % ": "[int(self.colonIndex)], time.localtime()) spinnerChar = self.vfd.userDefinedCharacters[0] self.vfd.defineCharacter(spinnerChar, spinner) self.vfd.writeScreen("%s\n%-9s%s %s" % (title, clock, playTime, spinnerChar))
def get_state(self): if xmms.is_playing() == 1: if xmms.is_paused() == 1: return 'pause' else: return 'play' else: return 'stop'
def play_title(self): title = "XMMS not playing!" if xmms.is_playing(): idx = xmms.get_playlist_pos() title = xmms.get_playlist_title(idx) print "Sending title '%s'." % title self.client_socket.sendall(title)
def slowUpdate(self): self.timeout -= 1 if self.timeout < 0: self.transition(IdleState) if xmms.is_paused(): self.transition(PausedState) elif xmms.is_playing(): self.transition(BeginPlayingState)
def slowUpdate(self): for e in self.effects: e.slowUpdate() self.timeout -= 1 if xmms.is_paused(): self.transition(PausedState) elif not xmms.is_playing(): self.transition(StoppedState) if self.timeout < 0: self.resetEffect()
def slowUpdate(self): self.pattern.scrollRight() self.pattern.set(self.led) self.led.blit() self.timeout -= 1 if xmms.is_paused(): self.transition(PausedState) elif not xmms.is_playing(): self.transition(StoppedState) if self.timeout < 0: self.transition(BeginPlayingFaderState)
def slowUpdate(self): # Get the current song title title = str(xmms.get_playlist_title(xmms.get_playlist_pos())) if len(title) > self.vfd.width: # Scroll it around so we can see the whole thing. At the beginning # of the scroll cycle it delays by scrollerDelay scroll cycles, # and there is a scrollerGap character gap between copies of the scrolled title. if title != self.lastTitle: self.scrollerIndex = -self.scrollerDelay self.lastTitle = title if self.scrollerIndex > 0: self.scrollerIndex %= self.scrollerGap + len(title) if self.scrollerIndex == 0: self.scrollerIndex = -self.scrollerDelay else: title = ("%s%s%s" % (title, " " * self.scrollerGap, title))[self.scrollerIndex:] self.scrollerIndex += 1 # get the current time index if xmms.is_playing(): millisec = xmms.get_output_time() minutes = millisec / 60000 seconds = (millisec % 60000) / 1000.0 playTime = "%3d:%02d" % (minutes, seconds) else: playTime = " --:--" # Status string if xmms.is_paused(): status = 'Paused' spinner = '-' elif xmms.is_playing(): status = 'Playing...' self.spinnerState = self.spinnerState[1:] + self.spinnerState[0] spinner = self.spinnerState[0] else: status = 'Idle' spinner = ' ' self.vfd.writeScreen("%s\n%-12s%s %s" % (title, status, playTime, spinner))
def is_playing(self): return xmms.is_playing()
def is_playing(self): if not self.isFrozen: self.isPlaying = xmms.is_paused( ) == 0 and xmms.is_playing() == 1 #must be this combination return self.isPlaying
def is_playing(self): if not self.isFrozen: self.isPlaying = xmms.is_paused() == 0 and xmms.is_playing() == 1 #must be this combination return self.isPlaying
def M_p(self,evt): if xmms.is_playing(): xmms.pause() else: xmms.play() self.done()
def slowUpdate(self): if xmms.is_paused(): self.transition(PausedState) elif xmms.is_playing(): self.transition(BeginPlayingState)
def slowUpdate(self): if not xmms.is_paused(): if xmms.is_playing(): self.transition(BeginPlayingState) else: self.transition(StoppedState)
def a(): xmms.playlist_next() print xmms.is_playing() time.sleep(0.1) print xmms.get_playlist_title(xmms.get_playlist_pos())