How to use the pyatv.convert.playstate function in pyatv

To help you get started, we’ve selected a few pyatv examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github postlund / pyatv / tests / test_convert.py View on Github external
def test_regular_playstates(self):
        self.assertEqual(DeviceState.Idle,
                         convert.playstate(PLAY_STATE_IDLE))
        self.assertEqual(DeviceState.Loading,
                         convert.playstate(PLAY_STATE_LOADING))
        self.assertEqual(DeviceState.Stopped,
                         convert.playstate(PLAY_STATE_STOPPED))
        self.assertEqual(DeviceState.Paused,
                         convert.playstate(PLAY_STATE_PAUSED))
        self.assertEqual(DeviceState.Playing,
                         convert.playstate(PLAY_STATE_PLAYING))
        self.assertEqual(DeviceState.Seeking,
                         convert.playstate(PLAY_STATE_FORWARD))
        self.assertEqual(DeviceState.Seeking,
                         convert.playstate(PLAY_STATE_BACKWARD))
github postlund / pyatv / tests / test_types.py View on Github external
def test_regular_play_states(self):
        self.assertEqual(const.PLAY_STATE_LOADING,
                         convert.playstate(PLAY_STATE_LOADING))
        self.assertEqual(const.PLAY_STATE_PAUSED,
                         convert.playstate(PLAY_STATE_PAUSED))
        self.assertEqual(const.PLAY_STATE_PLAYING,
                         convert.playstate(PLAY_STATE_PLAYING))
        self.assertEqual(const.PLAY_STATE_FAST_FORWARD,
                         convert.playstate(PLAY_STATE_FORWARD))
        self.assertEqual(const.PLAY_STATE_FAST_BACKWARD,
                         convert.playstate(PLAY_STATE_BACKWARD))
github postlund / pyatv / tests / test_types.py View on Github external
def test_play_state_no_media(self):
        # This test should not really be here as "None" is in reality not a
        # valid value. But it is supported nonetheless because that makes
        # usage nicer. None means that the field is not included in a
        # server response, which matches the behavior of dmap.first.
        self.assertEqual(const.PLAY_STATE_NO_MEDIA,
                         convert.playstate(None))
github postlund / pyatv / tests / test_convert.py View on Github external
def test_regular_playstates(self):
        self.assertEqual(DeviceState.Idle,
                         convert.playstate(PLAY_STATE_IDLE))
        self.assertEqual(DeviceState.Loading,
                         convert.playstate(PLAY_STATE_LOADING))
        self.assertEqual(DeviceState.Stopped,
                         convert.playstate(PLAY_STATE_STOPPED))
        self.assertEqual(DeviceState.Paused,
                         convert.playstate(PLAY_STATE_PAUSED))
        self.assertEqual(DeviceState.Playing,
                         convert.playstate(PLAY_STATE_PLAYING))
        self.assertEqual(DeviceState.Seeking,
                         convert.playstate(PLAY_STATE_FORWARD))
        self.assertEqual(DeviceState.Seeking,
                         convert.playstate(PLAY_STATE_BACKWARD))
github postlund / pyatv / tests / test_convert.py View on Github external
def test_unknown_playstate_throws(self):
        with self.assertRaises(exceptions.UnknownPlayState):
            convert.playstate(99999)
github postlund / pyatv / tests / test_types.py View on Github external
def test_regular_play_states(self):
        self.assertEqual(const.PLAY_STATE_LOADING,
                         convert.playstate(PLAY_STATE_LOADING))
        self.assertEqual(const.PLAY_STATE_PAUSED,
                         convert.playstate(PLAY_STATE_PAUSED))
        self.assertEqual(const.PLAY_STATE_PLAYING,
                         convert.playstate(PLAY_STATE_PLAYING))
        self.assertEqual(const.PLAY_STATE_FAST_FORWARD,
                         convert.playstate(PLAY_STATE_FORWARD))
        self.assertEqual(const.PLAY_STATE_FAST_BACKWARD,
                         convert.playstate(PLAY_STATE_BACKWARD))
github postlund / pyatv / pyatv / internal / apple_tv.py View on Github external
def play_state(self):
        """Current play state, e.g. playing or paused."""
        state = dmap.first(self.playstatus, 'cmst', 'caps')
        return convert.playstate(state)
github postlund / pyatv / pyatv / dmap / __init__.py View on Github external
def device_state(self):
        """Device state, e.g. playing or paused."""
        state = parser.first(self.playstatus, 'cmst', 'caps')
        return convert.playstate(state)