Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"""Communicate with an Android TV or Amazon Fire TV device via ADB over a network.
ADB Debugging must be enabled.
"""
import logging
from .basetv import BaseTV
from .. import constants
from ..adb_manager.adb_manager_async import ADBPythonAsync, ADBServerAsync
_LOGGER = logging.getLogger(__name__)
class BaseTVAsync(BaseTV):
"""Base class for representing an Android TV / Fire TV device.
The ``state_detection_rules`` parameter is of the format:
.. code-block:: python
state_detection_rules = {'com.amazon.tv.launcher': ['idle'],
'com.netflix.ninja': ['media_session_state'],
'com.ellation.vrv': ['audio_state'],
'com.hulu.plus': [{'playing': {'wake_lock_size' : 4}},
{'paused': {'wake_lock_size': 2}}],
'com.plexapp.android': [{'paused': {'media_session_state': 3, 'wake_lock_size': 1}},
{'playing': {'media_session_state': 3}},
'idle']}
The keys are app IDs, and the values are lists of rules that are evaluated in order.
"""Communicate with an Android TV device via ADB over a network.
ADB Debugging must be enabled.
"""
import logging
from ..basetv.basetv import BaseTV
from .. import constants
_LOGGER = logging.getLogger(__name__)
class BaseAndroidTV(BaseTV): # pylint: disable=too-few-public-methods
"""Representation of an Android TV device.
Parameters
----------
host : str
The address of the device; may be an IP address or a host name
port : int
The device port to which we are connecting (default is 5555)
adbkey : str
The path to the ``adbkey`` file for ADB authentication
adb_server_ip : str
The IP address of the ADB server
adb_server_port : int
The port for the ADB server
state_detection_rules : dict, None
A dictionary of rules for determining the state (see :class:`~androidtv.basetv.basetv.BaseTV`)
"""Communicate with an Android TV or Amazon Fire TV device via ADB over a network.
ADB Debugging must be enabled.
"""
import logging
from .basetv import BaseTV
from .. import constants
from ..adb_manager.adb_manager_sync import ADBPythonSync, ADBServerSync
_LOGGER = logging.getLogger(__name__)
class BaseTVSync(BaseTV):
"""Base class for representing an Android TV / Fire TV device.
The ``state_detection_rules`` parameter is of the format:
.. code-block:: python
state_detection_rules = {'com.amazon.tv.launcher': ['idle'],
'com.netflix.ninja': ['media_session_state'],
'com.ellation.vrv': ['audio_state'],
'com.hulu.plus': [{'playing': {'wake_lock_size' : 4}},
{'paused': {'wake_lock_size': 2}}],
'com.plexapp.android': [{'paused': {'media_session_state': 3, 'wake_lock_size': 1}},
{'playing': {'media_session_state': 3}},
'idle']}
The keys are app IDs, and the values are lists of rules that are evaluated in order.
"""Communicate with an Amazon Fire TV device via ADB over a network.
ADB Debugging must be enabled.
"""
import logging
from ..basetv.basetv import BaseTV
from .. import constants
_LOGGER = logging.getLogger(__name__)
class BaseFireTV(BaseTV): # pylint: disable=too-few-public-methods
"""Representation of an Amazon Fire TV device.
Parameters
----------
host : str
The address of the device; may be an IP address or a host name
port : int
The device port to which we are connecting (default is 5555)
adbkey : str
The path to the ``adbkey`` file for ADB authentication
adb_server_ip : str
The IP address of the ADB server
adb_server_port : int
The port for the ADB server
state_detection_rules : dict, None
A dictionary of rules for determining the state (see :class:`~androidtv.basetv.basetv.BaseTV`)