Module pyatv.const

Constants used in the public API.

Expand source code
"""Constants used in the public API."""

from enum import Enum


MAJOR_VERSION = "0"
MINOR_VERSION = "6"
PATCH_VERSION = "1"
__short_version__ = "{}.{}".format(MAJOR_VERSION, MINOR_VERSION)
__version__ = "{}.{}".format(__short_version__, PATCH_VERSION)


class Protocol(Enum):
    """All supported protocols."""

    DMAP = 1
    """Protocol constant representing DMAP."""

    MRP = 2
    """Protocol constant representing MRP."""

    AirPlay = 3
    """Protocol constant representing AirPlay."""


class MediaType(Enum):
    """All supported media types."""

    Unknown = 0
    """Media type is not known.

    This can be either the case that nothing is playing or the app does
    not report a valid media type.
    """

    Video = 1
    """Media type is video."""

    Music = 2
    """Media type is music."""

    TV = 3
    """Media type is a TV show."""


class DeviceState(Enum):
    """All supported device states."""

    Idle = 0
    """Device is idling, i.e. nothing is playing or about to play."""

    Loading = 1
    """Media is being loaded but not yet playing."""

    Paused = 2
    """Media is in paused state."""

    Playing = 3
    """Media is playing."""

    Stopped = 4
    """Media is stopped."""

    Seeking = 5
    """Media is seeking, e.g fast forward."""


class RepeatState(Enum):
    """All supported repeat states."""

    Off = 0
    """Repeat is off."""

    Track = 1
    """Repeat current track or item."""

    All = 2
    """Repeat all tracks or items."""


class ShuffleState(Enum):
    """All supported shuffle states."""

    Off = 0
    """Shuffle is off."""

    Albums = 1
    """Shuffle on album level."""

    Songs = 2
    """Shuffle on song level."""


class PowerState(Enum):
    """All supported power states."""

    Unknown = 0
    """Power state is not determinable."""

    Off = 1
    """Device is turned off (standby)."""

    On = 2
    """Device is turned on."""


class OperatingSystem(Enum):
    """Operating system on device."""

    Unknown = 0
    """Operating system is not known."""

    Legacy = 1
    """Operating system  is Apple TV Software (pre-tvOS)."""

    TvOS = 2
    """Operating system is tvOS."""


class DeviceModel(Enum):
    """Hardware device model."""

    Unknown = 0
    """Device model is unknown."""

    Gen2 = 1
    """Device model is second generation (Apple TV 2)."""

    Gen3 = 2
    """Device model is third generation (Apple TV 3)."""

    Gen4 = 3
    """Device model is fourth generation (Apple TV 4)."""

    Gen4K = 4
    """Device model is Apple TV 4K."""


class InputAction(Enum):
    """Type of input when pressing a button."""

    SingleTap = 0
    """Press and release quickly."""

    DoubleTap = 1
    """Press and release twice quickly."""

    Hold = 2
    """Press and hold for one second before releasing."""


class FeatureState(Enum):
    """State of a particular feature."""

    Unknown = 0
    """Feature is supported by device but it is not known if it is available or not."""

    Unsupported = 1
    """Device does not support this feature."""

    Unavailable = 2
    """Feature is supported by device but not available now.

    Pause is for instance unavailable if nothing is playing.
    """

    Available = 3
    """Feature is supported and available."""


# This enum is generated by scripts/features.py
class FeatureName(Enum):
    """All supported features."""

    Up = 0
    """Up button on remote."""

    Down = 1
    """Down button on remote."""

    Left = 2
    """Left button on remote."""

    Right = 3
    """Right button on remote."""

    Play = 4
    """Start playing media."""

    PlayPause = 5
    """Toggle between play/pause."""

    Pause = 6
    """Pause playing media."""

    Stop = 7
    """Stop playing media."""

    Next = 8
    """Change to next item."""

    Previous = 9
    """Change to previous item."""

    Select = 10
    """Select current option."""

    Menu = 11
    """Go back to previous menu."""

    VolumeUp = 12
    """Increase volume."""

    VolumeDown = 13
    """Decrease volume."""

    Home = 14
    """Home/TV button."""

    HomeHold = 15
    """Long-press home button."""

    TopMenu = 16
    """Go to main menu."""

    Suspend = 17
    """Suspend device (deprecated; use Power.turn_off)."""

    WakeUp = 18
    """Wake up device (deprecated; use Power.turn_on)."""

    SkipForward = 36
    """Skip forward a time interval."""

    SkipBackward = 37
    """Skip backwards a time interval."""

    SetPosition = 19
    """Seek to position."""

    SetShuffle = 20
    """Change shuffle state."""

    SetRepeat = 21
    """Change repeat state."""

    Title = 22
    """Title of playing media."""

    Artist = 23
    """Artist of playing song."""

    Album = 24
    """Album from playing artist."""

    Genre = 25
    """Genre of playing song."""

    TotalTime = 26
    """Total length of playing media (seconds)."""

    Position = 27
    """Current play time position."""

    Shuffle = 28
    """Shuffle stat.e"""

    Repeat = 29
    """Repeat state."""

    Artwork = 30
    """Playing media artwork."""

    App = 35
    """App playing media."""

    PlayUrl = 31
    """Stream a URL on device."""

    PowerState = 32
    """Current device power state."""

    TurnOn = 33
    """Turn device on."""

    TurnOff = 34
    """Turn off device."""

Classes

class DeviceModel (value, names=None, *, module=None, qualname=None, type=None, start=1)

Hardware device model.

Expand source code
class DeviceModel(Enum):
    """Hardware device model."""

    Unknown = 0
    """Device model is unknown."""

    Gen2 = 1
    """Device model is second generation (Apple TV 2)."""

    Gen3 = 2
    """Device model is third generation (Apple TV 3)."""

    Gen4 = 3
    """Device model is fourth generation (Apple TV 4)."""

    Gen4K = 4
    """Device model is Apple TV 4K."""

Ancestors

  • enum.Enum

Class variables

var Gen2

Device model is second generation (Apple TV 2).

var Gen3

Device model is third generation (Apple TV 3).

var Gen4

Device model is fourth generation (Apple TV 4).

var Gen4K

Device model is Apple TV 4K.

var Unknown

Device model is unknown.

class DeviceState (value, names=None, *, module=None, qualname=None, type=None, start=1)

All supported device states.

Expand source code
class DeviceState(Enum):
    """All supported device states."""

    Idle = 0
    """Device is idling, i.e. nothing is playing or about to play."""

    Loading = 1
    """Media is being loaded but not yet playing."""

    Paused = 2
    """Media is in paused state."""

    Playing = 3
    """Media is playing."""

    Stopped = 4
    """Media is stopped."""

    Seeking = 5
    """Media is seeking, e.g fast forward."""

Ancestors

  • enum.Enum

Class variables

var Idle

Device is idling, i.e. nothing is playing or about to play.

var Loading

Media is being loaded but not yet playing.

var Paused

Media is in paused state.

var Playing

Media is playing.

var Seeking

Media is seeking, e.g fast forward.

var Stopped

Media is stopped.

class FeatureName (value, names=None, *, module=None, qualname=None, type=None, start=1)

All supported features.

Expand source code
class FeatureName(Enum):
    """All supported features."""

    Up = 0
    """Up button on remote."""

    Down = 1
    """Down button on remote."""

    Left = 2
    """Left button on remote."""

    Right = 3
    """Right button on remote."""

    Play = 4
    """Start playing media."""

    PlayPause = 5
    """Toggle between play/pause."""

    Pause = 6
    """Pause playing media."""

    Stop = 7
    """Stop playing media."""

    Next = 8
    """Change to next item."""

    Previous = 9
    """Change to previous item."""

    Select = 10
    """Select current option."""

    Menu = 11
    """Go back to previous menu."""

    VolumeUp = 12
    """Increase volume."""

    VolumeDown = 13
    """Decrease volume."""

    Home = 14
    """Home/TV button."""

    HomeHold = 15
    """Long-press home button."""

    TopMenu = 16
    """Go to main menu."""

    Suspend = 17
    """Suspend device (deprecated; use Power.turn_off)."""

    WakeUp = 18
    """Wake up device (deprecated; use Power.turn_on)."""

    SkipForward = 36
    """Skip forward a time interval."""

    SkipBackward = 37
    """Skip backwards a time interval."""

    SetPosition = 19
    """Seek to position."""

    SetShuffle = 20
    """Change shuffle state."""

    SetRepeat = 21
    """Change repeat state."""

    Title = 22
    """Title of playing media."""

    Artist = 23
    """Artist of playing song."""

    Album = 24
    """Album from playing artist."""

    Genre = 25
    """Genre of playing song."""

    TotalTime = 26
    """Total length of playing media (seconds)."""

    Position = 27
    """Current play time position."""

    Shuffle = 28
    """Shuffle stat.e"""

    Repeat = 29
    """Repeat state."""

    Artwork = 30
    """Playing media artwork."""

    App = 35
    """App playing media."""

    PlayUrl = 31
    """Stream a URL on device."""

    PowerState = 32
    """Current device power state."""

    TurnOn = 33
    """Turn device on."""

    TurnOff = 34
    """Turn off device."""

Ancestors

  • enum.Enum

Class variables

var Album

Album from playing artist.

var App

App playing media.

var Artist

Artist of playing song.

var Artwork

Playing media artwork.

var Down

Down button on remote.

var Genre

Genre of playing song.

var Home

Home/TV button.

var HomeHold

Long-press home button.

var Left

Left button on remote.

var Menu

Go back to previous menu.

var Next

Change to next item.

var Pause

Pause playing media.

var Play

Start playing media.

var PlayPause

Toggle between play/pause.

var PlayUrl

Stream a URL on device.

var Position

Current play time position.

var PowerState

Current device power state.

var Previous

Change to previous item.

var Repeat

Repeat state.

var Right

Right button on remote.

var Select

Select current option.

var SetPosition

Seek to position.

var SetRepeat

Change repeat state.

var SetShuffle

Change shuffle state.

var Shuffle

Shuffle stat.e

var SkipBackward

Skip backwards a time interval.

var SkipForward

Skip forward a time interval.

var Stop

Stop playing media.

var Suspend

Suspend device (deprecated; use Power.turn_off).

var Title

Title of playing media.

var TopMenu

Go to main menu.

var TotalTime

Total length of playing media (seconds).

var TurnOff

Turn off device.

var TurnOn

Turn device on.

var Up

Up button on remote.

var VolumeDown

Decrease volume.

var VolumeUp

Increase volume.

var WakeUp

Wake up device (deprecated; use Power.turn_on).

class FeatureState (value, names=None, *, module=None, qualname=None, type=None, start=1)

State of a particular feature.

Expand source code
class FeatureState(Enum):
    """State of a particular feature."""

    Unknown = 0
    """Feature is supported by device but it is not known if it is available or not."""

    Unsupported = 1
    """Device does not support this feature."""

    Unavailable = 2
    """Feature is supported by device but not available now.

    Pause is for instance unavailable if nothing is playing.
    """

    Available = 3
    """Feature is supported and available."""

Ancestors

  • enum.Enum

Class variables

var Available

Feature is supported and available.

var Unavailable

Feature is supported by device but not available now.

Pause is for instance unavailable if nothing is playing.

var Unknown

Feature is supported by device but it is not known if it is available or not.

var Unsupported

Device does not support this feature.

class InputAction (value, names=None, *, module=None, qualname=None, type=None, start=1)

Type of input when pressing a button.

Expand source code
class InputAction(Enum):
    """Type of input when pressing a button."""

    SingleTap = 0
    """Press and release quickly."""

    DoubleTap = 1
    """Press and release twice quickly."""

    Hold = 2
    """Press and hold for one second before releasing."""

Ancestors

  • enum.Enum

Class variables

var DoubleTap

Press and release twice quickly.

var Hold

Press and hold for one second before releasing.

var SingleTap

Press and release quickly.

class MediaType (value, names=None, *, module=None, qualname=None, type=None, start=1)

All supported media types.

Expand source code
class MediaType(Enum):
    """All supported media types."""

    Unknown = 0
    """Media type is not known.

    This can be either the case that nothing is playing or the app does
    not report a valid media type.
    """

    Video = 1
    """Media type is video."""

    Music = 2
    """Media type is music."""

    TV = 3
    """Media type is a TV show."""

Ancestors

  • enum.Enum

Class variables

var Music

Media type is music.

var TV

Media type is a TV show.

var Unknown

Media type is not known.

This can be either the case that nothing is playing or the app does not report a valid media type.

var Video

Media type is video.

class OperatingSystem (value, names=None, *, module=None, qualname=None, type=None, start=1)

Operating system on device.

Expand source code
class OperatingSystem(Enum):
    """Operating system on device."""

    Unknown = 0
    """Operating system is not known."""

    Legacy = 1
    """Operating system  is Apple TV Software (pre-tvOS)."""

    TvOS = 2
    """Operating system is tvOS."""

Ancestors

  • enum.Enum

Class variables

var Legacy

Operating system is Apple TV Software (pre-tvOS).

var TvOS

Operating system is tvOS.

var Unknown

Operating system is not known.

class PowerState (value, names=None, *, module=None, qualname=None, type=None, start=1)

All supported power states.

Expand source code
class PowerState(Enum):
    """All supported power states."""

    Unknown = 0
    """Power state is not determinable."""

    Off = 1
    """Device is turned off (standby)."""

    On = 2
    """Device is turned on."""

Ancestors

  • enum.Enum

Class variables

var Off

Device is turned off (standby).

var On

Device is turned on.

var Unknown

Power state is not determinable.

class Protocol (value, names=None, *, module=None, qualname=None, type=None, start=1)

All supported protocols.

Expand source code
class Protocol(Enum):
    """All supported protocols."""

    DMAP = 1
    """Protocol constant representing DMAP."""

    MRP = 2
    """Protocol constant representing MRP."""

    AirPlay = 3
    """Protocol constant representing AirPlay."""

Ancestors

  • enum.Enum

Class variables

var AirPlay

Protocol constant representing AirPlay.

var DMAP

Protocol constant representing DMAP.

var MRP

Protocol constant representing MRP.

class RepeatState (value, names=None, *, module=None, qualname=None, type=None, start=1)

All supported repeat states.

Expand source code
class RepeatState(Enum):
    """All supported repeat states."""

    Off = 0
    """Repeat is off."""

    Track = 1
    """Repeat current track or item."""

    All = 2
    """Repeat all tracks or items."""

Ancestors

  • enum.Enum

Class variables

var All

Repeat all tracks or items.

var Off

Repeat is off.

var Track

Repeat current track or item.

class ShuffleState (value, names=None, *, module=None, qualname=None, type=None, start=1)

All supported shuffle states.

Expand source code
class ShuffleState(Enum):
    """All supported shuffle states."""

    Off = 0
    """Shuffle is off."""

    Albums = 1
    """Shuffle on album level."""

    Songs = 2
    """Shuffle on song level."""

Ancestors

  • enum.Enum

Class variables

var Albums

Shuffle on album level.

var Off

Shuffle is off.

var Songs

Shuffle on song level.