Exemplo n.º 1
0
 def play_state(self):
     """Play state, e.g. playing or paused."""
     # TODO: extract to a convert module
     state = self._setstate.playbackState
     if state == 1:
         return const.PLAY_STATE_PLAYING
     elif state == 2:
         return const.PLAY_STATE_PAUSED
     else:
         raise exceptions.UnknownPlayState('Unknown playstate: ' +
                                           str(state))
Exemplo n.º 2
0
def playstate(state):
    """Convert iTunes playstate to API representation."""
    if state is None:
        return const.PLAY_STATE_NO_MEDIA
    elif state == 1:
        return const.PLAY_STATE_LOADING
    elif state == 3:
        return const.PLAY_STATE_PAUSED
    elif state == 4:
        return const.PLAY_STATE_PLAYING
    elif state == 5:
        return const.PLAY_STATE_FAST_FORWARD
    elif state == 6:
        return const.PLAY_STATE_FAST_BACKWARD

    raise exceptions.UnknownPlayState('Unknown playstate: ' + str(state))
Exemplo n.º 3
0
def playstate(state):
    """Convert iTunes playstate to API representation."""
    # pylint: disable=too-many-return-statements
    if state == 0 or state is None:
        return DeviceState.Idle
    if state == 1:
        return DeviceState.Loading
    if state == 2:
        return DeviceState.Stopped
    if state == 3:
        return DeviceState.Paused
    if state == 4:
        return DeviceState.Playing
    if state in (5, 6):
        return DeviceState.Seeking

    raise exceptions.UnknownPlayState('Unknown playstate: ' + str(state))
Exemplo n.º 4
0
def playstate(state):
    """Convert iTunes playstate to API representation."""
    # pylint: disable=too-many-return-statements
    if state is None:
        return const.PLAY_STATE_NO_MEDIA
    if state == 0:
        return const.PLAY_STATE_IDLE
    if state == 1:
        return const.PLAY_STATE_LOADING
    if state == 3:
        return const.PLAY_STATE_PAUSED
    if state == 4:
        return const.PLAY_STATE_PLAYING
    if state == 5:
        return const.PLAY_STATE_FAST_FORWARD
    if state == 6:
        return const.PLAY_STATE_FAST_BACKWARD

    raise exceptions.UnknownPlayState('Unknown playstate: ' + str(state))