braviaproapi.bravia.AvContent

class braviaproapi.bravia.AvContent(bravia_client, http_client)

Bases: object

Provides functionality for controlling what is played on the target device.

Parameters:
  • bravia_client – The parent BraviaClient instance.
  • http_client – The Http instance associated with the parent client.
get_content_count(source)

Returns a count of the number of available contents for a given source.

Parameters:source (-) – The URI of the source to enumerate. See the Sony documentation for more information.
Raises:
  • TypeError – One or more arguments is the incorrect type.
  • ValueError – One or more arguments is invalid.
  • ApiError – The request to the target device failed.
Returns:

The count of available content.

Return type:

int

get_content_list(source)

Returns a list of available content for a given source.

Parameters:source (-) – The URI of the source to enumerate. See the Sony documentation for more information.
Raises:
  • TypeError – One or more arguments is the incorrect type.
  • ValueError – One or more arguments is invalid.
  • ApiError – The request to the target device failed.
Returns:

A list of dicts containing the following keys. If no content is available, returns None.

  • channel_info (dict or None): If the content is a television channel, this provides the following information. If the content is not a television channel, this is None.
    • channel_full (str): The full channel number (e.g. 7.2)
    • channel_main (str): The primary channel number (e.g. 7)
    • channel_sub (str or None): The subchannel number, if available (e.g. 2)
    • visible (bool): Whether the channel is enabled (“visible”) on the television.
  • index (str): The position of the content in the list.
  • name (str or None): The title of the content, if applicable.
  • uri (str or None): The URI at which the content can be accessed, if applicable.

Return type:

list(dict) or None

get_external_input_status()

Returns information about the target device’s external inputs.

Raises:ApiError – The request to the target device failed.
Returns:A list of dicts with the following keys:
  • uri (str or None): The URI at which the input can be accessed, if applicable.
  • name (str or None): The system title of the input, if applicable.
  • connected (bool): True if the input is currently connected, False otherwise.
  • custom_label (str or None): The user-entered title of the input, if set.
  • icon (InputIcon): The icon for the input. If no appropriate icon is available, this is InputIcon.UNKNOWN.
  • has_signal (bool): True if input is currently sending a signal to the target device, False otherwise.
Return type:list(dict)
get_playing_content_info()

Returns information about the currently playing content on the target device.

Raises:ApiError – The request to the target device failed.
Returns:A dict containing the following keys. If no content is playing, returns None.
  • uri (str or None): The URI at which the content can be accessed, if applicable.
  • source (str or None): The source that the content resides within, if applicable.
  • name (str or None): The title of the playing content, if applicable.
Return type:dict or None
get_scheme_list()

Returns a list of available content schemes the target device supports.

Raises:ApiError – The request to the target device failed.
Returns:A list of string names of available schemes.
Return type:list(str)
get_source_list(scheme)

Returns a list of available source types for a given content scheme.

Parameters:

scheme (str) – The scheme for which to get sources (retrieve this from get_scheme_list()).

Raises:
  • TypeError – One or more arguments is the incorrect type.
  • ValueError – One or more arguments is invalid.
  • ApiError – The request to the target device failed.
Returns:

A list of string source URIs for the specified scheme. If scheme is not supported, returns None.

Return type:

list(str) or None

set_play_content(uri)

Activates the specified content on the target device.

Parameters:

uri (str) – The URI at which the content can be accessed. Find the URI from the results of the get_content_list() function.

Raises:
  • TypeError – One or more arguments is the incorrect type.
  • ValueError – One or more arguments is invalid.
  • ApiError – The request to the target device failed.
class braviaproapi.bravia.InputIcon

Bases: enum.Enum

Describes icon types for input sources.

UNKNOWN

The icon type was not recognized.

COMPOSITE

Composite input

SVIDEO

S-Video input

COMPOSITE_COMPONENTD

Japanese D-terminal composite/component input

COMPONENTD

Japanese D-terminal component input

COMPONENT

Component (YPbPr) input

SCART

SCART RGB input

HDMI

HDMI input

VGA

VGA D-sub input

TUNER

Coaxial TV tuner input

TAPE

Tape input

DISC

Disc input

COMPLEX

Complex input

AV_AMP

Audio amplifier input

HOME_THEATER

Home theater system input

GAME

Video game input

CAMCORDER

Camcorder input

DIGITAL_CAMERA

Digital camera input

PC

Computer input

TV

Television input

AUDIO_SYSTEM

Audio system input

RECORDING_DEVICE

Recorder device input

PLAYBACK_DEVICE

Player device input

TUNER_DEVICE

Television tuner device input

WIFI_DISPLAY

Wi-Fi display input