Skip to content

Commit

Permalink
More renaming 'androidtv' -> 'aio_androidtv'
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffLIrion committed May 9, 2020
1 parent 410f7a6 commit f9b0c8e
Show file tree
Hide file tree
Showing 18 changed files with 98 additions and 85 deletions.
22 changes: 11 additions & 11 deletions README.rst
@@ -1,26 +1,26 @@
python-androidtv
================
aio-androidtv
=============

.. image:: https://travis-ci.com/JeffLIrion/python-androidtv.svg?branch=master
:target: https://travis-ci.com/JeffLIrion/python-androidtv
.. image:: https://travis-ci.com/JeffLIrion/aio-androidtv.svg?branch=master
:target: https://travis-ci.com/JeffLIrion/aio-androidtv
:alt: Build Status
.. image:: https://coveralls.io/repos/github/JeffLIrion/python-androidtv/badge.svg
:target: https://coveralls.io/github/JeffLIrion/python-androidtv
.. image:: https://coveralls.io/repos/github/JeffLIrion/aio-androidtv/badge.svg
:target: https://coveralls.io/github/JeffLIrion/aio-androidtv
:alt: Coverage Status

Documentation for this package can be found at `https://androidtv.readthedocs.io <https://androidtv.readthedocs.io>`_.
Documentation for this package can be found at `https://aio-androidtv.readthedocs.io <https://aio-androidtv.readthedocs.io>`_.

``androidtv`` is a Python 3 package that provides state information and control of Android TV and Fire TV devices via ADB. This package is used by the `Android TV <https://www.home-assistant.io/components/androidtv/>`_ integration in Home Assistant.
``aio-androidtv`` is a Python 3.7+ package that provides state information and control of Android TV and Fire TV devices via ADB.


Installation
------------

Be sure you install into a Python 3.x environment.
Be sure you install into a Python 3.7+ environment.

.. code-block:: bash
pip install androidtv
pip install aio-androidtv
ADB Intents and Commands
Expand All @@ -31,4 +31,4 @@ A collection of useful intents and commands can be found `here <https://gist.git
Acknowledgments
---------------

This is based on `python-firetv <https://github.com/happyleavesaoc/python-firetv>`_ by happyleavesaoc and the `androidtv component for Home Assistant <https://github.com/a1ex4/home-assistant/blob/androidtv/homeassistant/components/media_player/androidtv.py>`_ by a1ex4, and it depends on the Python packages `adb-shell <https://github.com/JeffLIrion/adb_shell>`_ (which is based on `python-adb <https://github.com/google/python-adb>`_) and `pure-python-adb <https://github.com/Swind/pure-python-adb>`_.
This is based on `python-firetv <https://github.com/happyleavesaoc/python-firetv>`_ by happyleavesaoc and the `androidtv component for Home Assistant <https://github.com/a1ex4/home-assistant/blob/androidtv/homeassistant/components/media_player/androidtv.py>`_ by a1ex4, and it depends on the Python package `aio-adb-shell <https://github.com/JeffLIrion/aio_adb_shell>`_ (which is based on `python-adb <https://github.com/google/python-adb>`_).
7 changes: 7 additions & 0 deletions docs/source/aio_androidtv.adb_manager.rst
@@ -0,0 +1,7 @@
aio\_androidtv.adb\_manager module
==================================

.. automodule:: aio_androidtv.adb_manager
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/source/aio_androidtv.androidtv.rst
@@ -0,0 +1,7 @@
aio\_androidtv.androidtv module
===============================

.. automodule:: aio_androidtv.androidtv
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/source/aio_androidtv.basetv.rst
@@ -0,0 +1,7 @@
aio\_androidtv.basetv module
============================

.. automodule:: aio_androidtv.basetv
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/source/aio_androidtv.constants.rst
@@ -0,0 +1,7 @@
aio\_androidtv.constants module
===============================

.. automodule:: aio_androidtv.constants
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/source/aio_androidtv.exceptions.rst
@@ -0,0 +1,7 @@
aio\_androidtv.exceptions module
================================

.. automodule:: aio_androidtv.exceptions
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/source/aio_androidtv.firetv.rst
@@ -0,0 +1,7 @@
aio\_androidtv.firetv module
============================

.. automodule:: aio_androidtv.firetv
:members:
:undoc-members:
:show-inheritance:
23 changes: 23 additions & 0 deletions docs/source/aio_androidtv.rst
@@ -0,0 +1,23 @@
aio\_androidtv package
======================

Submodules
----------

.. toctree::
:maxdepth: 4

aio_androidtv.adb_manager
aio_androidtv.androidtv
aio_androidtv.basetv
aio_androidtv.constants
aio_androidtv.exceptions
aio_androidtv.firetv

Module contents
---------------

.. automodule:: aio_androidtv
:members:
:undoc-members:
:show-inheritance:
7 changes: 0 additions & 7 deletions docs/source/androidtv.adb_manager.rst

This file was deleted.

7 changes: 0 additions & 7 deletions docs/source/androidtv.androidtv.rst

This file was deleted.

7 changes: 0 additions & 7 deletions docs/source/androidtv.basetv.rst

This file was deleted.

7 changes: 0 additions & 7 deletions docs/source/androidtv.constants.rst

This file was deleted.

7 changes: 0 additions & 7 deletions docs/source/androidtv.firetv.rst

This file was deleted.

21 changes: 0 additions & 21 deletions docs/source/androidtv.rst

This file was deleted.

8 changes: 4 additions & 4 deletions docs/source/conf.py
Expand Up @@ -138,7 +138,7 @@
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'aio_androidtv.tex', 'aio_androidtv Documentation',
(master_doc, 'aio-androidtv.tex', 'aio-androidtv Documentation',
'Jeff Irion', 'manual'),
]

Expand All @@ -148,7 +148,7 @@
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'aio_androidtv', 'aio_androidtv Documentation',
(master_doc, 'aio-androidtv', 'aio-androidtv Documentation',
[author], 1)
]

Expand All @@ -159,8 +159,8 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'aio_androidtv', 'aio_androidtv Documentation',
author, 'aio_androidtv', 'One line description of project.',
(master_doc, 'aio-androidtv', 'aio-androidtv Documentation',
author, 'aio-androidtv', 'One line description of project.',
'Miscellaneous'),
]

Expand Down
4 changes: 2 additions & 2 deletions docs/source/index.rst
Expand Up @@ -3,8 +3,8 @@
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
androidtv Documentation
=======================
aio-androidtv Documentation
===========================

.. toctree::
:hidden:
Expand Down
6 changes: 3 additions & 3 deletions docs/source/modules.rst
@@ -1,7 +1,7 @@
androidtv
=========
aio_androidtv
=============

.. toctree::
:maxdepth: 4

androidtv
aio_androidtv
22 changes: 13 additions & 9 deletions tests/test_homeassistant.py
Expand Up @@ -497,7 +497,8 @@ async def setUp(self):
class TestADBCommandAndFileSync(unittest.TestCase):
"""Test ADB and FileSync services."""

def test_adb_command(self):
@awaiter
async def test_adb_command(self):
"""Test sending a command via the `androidtv.adb_command` service."""
patch_key = "server"
command = "test command"
Expand All @@ -509,13 +510,14 @@ def test_adb_command(self):
)
self.aftv = AndroidTVDevice(aftv, "Fake Android TV", {}, True, None, None)

with patch("androidtv.basetv.BaseTV.adb_shell", return_value=response) as patch_shell:
self.aftv.adb_command(command)
with patch("aio_androidtv.basetv.BaseTV.adb_shell", return_value=response) as patch_shell:
await self.aftv.adb_command(command)

patch_shell.assert_called_with(command)
assert self.aftv._adb_response == response

def test_adb_command_key(self):
@awaiter
async def test_adb_command_key(self):
"""Test sending a key command via the `androidtv.adb_command` service."""
patch_key = "server"
command = "HOME"
Expand All @@ -527,13 +529,14 @@ def test_adb_command_key(self):
)
self.aftv = AndroidTVDevice(aftv, "Fake Android TV", {}, True, None, None)

with patch("androidtv.basetv.BaseTV.adb_shell", return_value=response) as patch_shell:
with patch("aio_androidtv.basetv.BaseTV.adb_shell", return_value=response) as patch_shell:
self.aftv.adb_command(command)

patch_shell.assert_called_with("input keyevent {}".format(self.aftv._keys[command]))
assert self.aftv._adb_response is None

def test_adb_command_get_properties(self):
@awaiter
async def test_adb_command_get_properties(self):
"""Test sending the "GET_PROPERTIES" command via the `androidtv.adb_command` service."""
patch_key = "server"
command = "GET_PROPERTIES"
Expand All @@ -545,13 +548,14 @@ def test_adb_command_get_properties(self):
)
self.aftv = AndroidTVDevice(aftv, "Fake Android TV", {}, True, None, None)

with patch("androidtv.androidtv.AndroidTV.get_properties_dict", return_value=response) as patch_get_props:
with patch("aio_androidtv.androidtv.AndroidTV.get_properties_dict", return_value=response) as patch_get_props:
self.aftv.adb_command(command)

assert patch_get_props.called
assert self.aftv._adb_response == str(response)

def test_update_lock_not_acquired(self):
@awaiter
async def test_update_lock_not_acquired(self):
"""Test that the state does not get updated when a `LockNotAcquiredException` is raised."""
patch_key = "server"

Expand All @@ -565,7 +569,7 @@ def test_update_lock_not_acquired(self):
self.aftv.update()
assert self.aftv.state == STATE_OFF

with patch("androidtv.androidtv.AndroidTV.update", side_effect=LockNotAcquiredException):
with patch("aio_androidtv.androidtv.AndroidTV.update", side_effect=LockNotAcquiredException):
with patchers.patch_shell("1")[patch_key]:
self.aftv.update()
assert self.aftv.state == STATE_OFF
Expand Down

0 comments on commit f9b0c8e

Please sign in to comment.