Skip to main content

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

Metadata

Release files for stb-automator 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for stb-automator 0.1.0
File Size Uploaded
stb-automator-0.1.0.tar.gz 9.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for stb-automator 0.1.0
File Interpreter ABI Platform
stb_automator-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 19.1 kB

Release files / stb-automator-0.1.0.tar.gz

Download URL stb-automator-0.1.0.tar.gz
Size 9.5 kB
Tags Source
SHA-256 checksum
How to use checksums
eb7e44808001ee8330c0bccd9038a70dad229944413ad6130dd7d02f33e9964b
BLAKE2b-256 checksum
How to use checksums
14b9618fdf5b934b3157927927edce8a2983592a1dfee3bea8cfe33ab9105c06
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.4 CPython/3.7.10 Linux/5.10.27-1-lts

Release files / stb_automator-0.1.0-py3-none-any.whl

Download URL stb_automator-0.1.0-py3-none-any.whl
Size 9.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6f9ecef335e010ddec88d354fb7cd65b45721f4626103bdad633068f42fefddf
BLAKE2b-256 checksum
How to use checksums
4969fe678222215dd13b01fc62cc0207bf0d1e276cbf7a0768ac7238dce6d412
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.4 CPython/3.7.10 Linux/5.10.27-1-lts

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page