Skip to main content

A library for automated control & testing of set-top boxes

Project description

Stb Automator

Automated Control & Testing for Set-Top Boxes

Python Platform Version Black Build Status codecov Documentation Status

Stb-automator allows you to issue commands to your set-top box (or whatever device you're wanting to control that takes in IR). It can then anaylze the behavior of the device and how it responds to those commands by inspecting the video output (using image recognition and OCR).

Full documentation can be found at https://stb-automator.readthedocs.io

Usage

Stb-automator is a regular python library. It does not come with a test runner or enforce a way for you to write your tests. You can use it with python's unittest or a third party library like pytest.

import stb

from pathlib import Path


# BaseFrame is a core class to inherit from so we can
# use the PageObject design pattern in our tests to ensure
# they're kept readable.
class Menu(stb.BaseFrame):

    def __init__(self):
        super().__init__()

    @property
    def is_visible(self):
        return (
            stb.match_image(Path('menu-banner.png')) and
            stb.match_text('Menu Page')
        )

def test_that_menu_key_brings_us_to_the_menu():
    stb.Remote("lirc-remote").press("KEY_MENU")
    assert Menu().is_visible

def test_that_settings_icon_is_in_active_state_in_menu():
    remote = stb.Remote("lirc-remote")
    remote.press("KEY_MENU")
    stb.wait_until_visible(Menu)
    remote.press_until_match("KEY_RIGHT", Path("settings-icon-active.png"))

We can then run our tests using, in this example, pytest. If the waiting for match or pressing until a match times out, an exception will be thrown and the test will fail. Otherwise, it will pass.

Installation

To install the python package, we can do so using pip.

$ pip install stb-automator

Installation Enviroment Requirements

Stb-automator requires OpenCV, LIRC, Gstreamer, and Tesseract OCR to be setup and installed already on the given system in order to work properly.

If you use Debian or a Debian derivative, there is a installation script for the prerequisites in tools/prerequisites-install-debian.sh. You will still have to figure out setup and configure for LIRC and Gstreamer. Further documentation on how to install these prerequisites and set it all up can be found at the full documentation site: https://stb-automator.readthedocs.io

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stb-automator-0.1.0.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

stb_automator-0.1.0-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file stb-automator-0.1.0.tar.gz.

File metadata

  • Download URL: stb-automator-0.1.0.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.7.10 Linux/5.10.27-1-lts

File hashes

Hashes for stb-automator-0.1.0.tar.gz
Algorithm Hash digest
SHA256 eb7e44808001ee8330c0bccd9038a70dad229944413ad6130dd7d02f33e9964b
MD5 94b19fe190e9f8860c8d9071c2d0f6f5
BLAKE2b-256 14b9618fdf5b934b3157927927edce8a2983592a1dfee3bea8cfe33ab9105c06

See more details on using hashes here.

File details

Details for the file stb_automator-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: stb_automator-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.7.10 Linux/5.10.27-1-lts

File hashes

Hashes for stb_automator-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6f9ecef335e010ddec88d354fb7cd65b45721f4626103bdad633068f42fefddf
MD5 02a5065d0eb221628fd9737ec8435648
BLAKE2b-256 4969fe678222215dd13b01fc62cc0207bf0d1e276cbf7a0768ac7238dce6d412

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page