Skip to main content

Build Status docs pypi python license

A Python library for controlling a SkyQ Box.

Introduction

This library aims to eventually provide API access to the Sky Q Set Top Box. It is only tested on Python 3.7 and uses the newer async support offered by this version of Python.

It uses the excellent trio async library and so knowledge of this is advised.

It is still a work in progress, but what is here, works.

Installing

To install:

pip install pyskyq

Usage

There are currently three main capabilities provided by the library.

Pressing buttons on the remote

Here is how to emulate a button-press on the SkyQ Remote. See the documentation for the class REMOTECOMMANDS for the various buttons that can be pressed.

from pyskyq import Remote, RCMD

    press_remote('skyq', RCMD.play)

Reacting to status changes on the box

Here is how to set up an async context manager that can be used to react to changed events on the box..

from pyskyq import get_status

async def report_box_online():
    """Report whether the SkyQ is online or not."""
    # pylint: disable=not-async-context-manager
    async with get_status('skyq') as stat:
        while True:
            if stat.online:
                print('The SkyQ Box is Online ')
            else:
                print('The SkyQ Box is Offline')
            await trio.sleep(1)
try:
    print("Type Ctrl-C to exit.")
    trio.run(report_box_online)
except KeyboardInterrupt:
    raise SystemExit(0)

Loading and interrogating channel data

Getting access to channel data requires initialising an EPG object. Once this is done, you need to load the channel data from the box using the EPG.load_skyq_channel_data() method.

To access this data use EPG.get_channel(). See the method’s documentation for the full list of available attributes.

from pyskyq import EPG

async def main():
    """Run main routine, allowing arguments to be passed."""
    pargs = parse_args(args)
    epg = EPG('skyq')  # replace with hostname / IP of your Sky box
    await epg.load_skyq_channel_data()  # load channel listing from Box.
    all_72_hour = XMLTVListing('http://www.xmltv.co.uk/feed/6715')

    async with trio.open_nursery() as nursery:
        nursery.start_soon(all_72_hour.fetch)

    epg.apply_XMLTVListing(all_72_hour)

    print('Channel Description from the SkyQ Box:')
    print(epg.get_channel_by_sid(2002).desc)
    print('Channel XMLTV ID from the XMLTV Feed:')
    print(epg.get_channel_by_sid(2002).xmltv_id)
    print('Channel Logo URL from the XMLTV Feed:')
    print(epg.get_channel_by_sid(2002).xmltv_icon_url)

if __name__ == "__main__":
    trio.run(main)

Documentation

Please refer to the documentation at https://bradwood.gitlab.io/pyskyq/

Contributions

Contributions are welcome. Please fork the project on GitLab Not GitHub and raise an issue and merge request there.

Credits

Code and ideas obtained from:

Thank you to those individuals for their contributions.

Release files for pyskyq 0.6.1

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

Source distribution (sdist)

Source distribution for pyskyq 0.6.1
File Size Uploaded
pyskyq-0.6.1.tar.gz 99.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyskyq 0.6.1
File Interpreter ABI Platform
pyskyq-0.6.1-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 124.4 kB

Release files / pyskyq-0.6.1.tar.gz

Download URL pyskyq-0.6.1.tar.gz
Size 99.4 kB
Tags Source
SHA-256 checksum
How to use checksums
c355485487fd9e323446f443d6d3a8b7aaacf71ad5b7c0630c86a57758e7bc49
BLAKE2b-256 checksum
How to use checksums
4622b2f6f2037c8633e33e163974bce696a9ed08ca20dd1164cc23114ffecc9a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.4.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1

Release files / pyskyq-0.6.1-py2.py3-none-any.whl

Download URL pyskyq-0.6.1-py2.py3-none-any.whl
Size 25.0 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
826f18d8e4805b13dc729f37860fa54ccffeec25bdd708421787cd19b76b50dc
BLAKE2b-256 checksum
How to use checksums
9fff6673d61de6b740e1880ac2c0e51727bb144f31b086c48bff1e79da9880cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.4.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1

Release history Release notifications | RSS feed

This release

0.6.1 This release

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.7

2 release files

0.1.3

2 release files

0.1.1

2 release files

0.0.9

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