Skip to content

Commit

Permalink
Merge 842beff into 895faa1
Browse files Browse the repository at this point in the history
  • Loading branch information
ehendrix23 committed Jan 16, 2019
2 parents 895faa1 + 842beff commit 1effb0e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pyatv/const.py
Expand Up @@ -44,6 +44,9 @@
#: Media is being rewinded
PLAY_STATE_FAST_BACKWARD = 6

#: Media is stopped
PLAY_STATE_STOPPED = 7


# Corresponds to "repeatstate", dacp.repeatstate, in iTunes

Expand Down
4 changes: 4 additions & 0 deletions pyatv/convert.py
Expand Up @@ -39,6 +39,8 @@ def playstate(state):
return const.PLAY_STATE_IDLE
if state == 1:
return const.PLAY_STATE_LOADING
if state == 2:
return const.PLAY_STATE_STOPPED
if state == 3:
return const.PLAY_STATE_PAUSED
if state == 4:
Expand Down Expand Up @@ -68,6 +70,8 @@ def playstate_str(state):
return 'Fast forward'
if state == const.PLAY_STATE_FAST_BACKWARD:
return 'Fast backward'
if state == const.PLAY_STATE_STOPPED:
return 'Stopped'
return 'Unsupported'


Expand Down
3 changes: 3 additions & 0 deletions tests/test_convert.py
Expand Up @@ -38,6 +38,7 @@
# Key: cmst.caps
PLAY_STATE_IDLE = 0
PLAY_STATE_LOADING = 1 # E.g. buffering
PLAY_STATE_STOPPED = 2
PLAY_STATE_PAUSED = 3
PLAY_STATE_PLAYING = 4
PLAY_STATE_FORWARD = 5
Expand Down Expand Up @@ -121,6 +122,8 @@ def test_regular_playstates(self):
convert.playstate(PLAY_STATE_IDLE))
self.assertEqual(const.PLAY_STATE_LOADING,
convert.playstate(PLAY_STATE_LOADING))
self.assertEqual(const.PLAY_STATE_STOPPED,
convert.playstate(PLAY_STATE_STOPPED))
self.assertEqual(const.PLAY_STATE_PAUSED,
convert.playstate(PLAY_STATE_PAUSED))
self.assertEqual(const.PLAY_STATE_PLAYING,
Expand Down

0 comments on commit 1effb0e

Please sign in to comment.