Example #1
0
 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)
Example #2
0
 def get_state(self):
     if xmms.is_playing() == 1:
         if xmms.is_paused() == 1:
             return 'pause'
         else:
             return 'play'
     else:
         return 'stop'
	def get_state(self):
		if xmms.is_playing() == 1:
			if xmms.is_paused() == 1:
				return 'pause'
			else:
				return 'play'
		else:
			return 'stop'
Example #4
0
 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()
Example #5
0
 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)
Example #6
0
    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))
Example #7
0
    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))
Example #8
0
 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
Example #10
0
 def play_pause(self):
     xmms.play_pause()
     state = xmms.is_paused()
     print "Pause/Stop."
Example #11
0
 def slowUpdate(self):
     if not xmms.is_paused():
         if xmms.is_playing():
             self.transition(BeginPlayingState)
         else:
             self.transition(StoppedState)
Example #12
0
 def slowUpdate(self):
     if xmms.is_paused():
         self.transition(PausedState)
     elif xmms.is_playing():
         self.transition(BeginPlayingState)
Example #13
0
 def play_pause(self):
     xmms.play_pause()
     state = xmms.is_paused()
     print "Pause/Stop."