Skip to main content

Scans LAN for any Roku devices and fetches device, app, active-app, and player information.

Project description

Roku-Scanner 1.0.1

Scans LAN for any connected Roku's and returns available device information.

Prerequisites

Installation

pip install roku-scanner

Usage

CLI

python -m roku_scanner

Options

Device data output in JSON.

python -m roku_scanner --json

Increasing timeout on discovery search time. Default is 2 secs. It's advised to use a time less than 10 secs.

python -m roku_scanner --timeout 5

Change search target to target all devices and not only Roku devices. This will result in non roku devices being added to discovery data. As now(1.0.1) only discovery data is returned for non Roku devices.

python -m roku_scanner --search-target-all

Import Examples

Discovery and device data fetching

Discovering Roku's and fetching their device data.

from roku_scanner.scanner import Scanner
from roku_scanner.roku import Roku

scanner = Scanner()
scanner.discover()

found_devices = scanner.discovered_devices

for device in found_devices:
    roku_location = device.get('LOCATION')
    roku = Roku(location=roku_location, discovery_data=device)
    roku.fetch_data()
    detailed_device_data = roku.data
    print(detailed_device_data)

JSON

Getting device data in JSON.

from roku_scanner.scanner import Scanner
from roku_scanner.roku import Roku

scanner = Scanner()
scanner.discover()

found_devices = scanner.discovered_devices

for device in found_devices:
    roku_location = device.get('LOCATION')
    roku = Roku(location=roku_location, discovery_data=device)
    roku.fetch_data()
    json_data = roku.as_json()

XML

Getting device data as XML.

from roku_scanner.scanner import Scanner
from roku_scanner.roku import Roku

scanner = Scanner()
scanner.discover()

found_devices = scanner.discovered_devices

for device in found_devices:
    roku_location = device.get('LOCATION')
    roku = Roku(location=roku_location, discovery_data=device)
    roku.fetch_data()
    json_data = roku.as_xml()

Search Target in Scanner

Changes search target for scanner to search for all devices, this will return Roku devices and any other using UPnP

from roku_scanner.scanner import Scanner

scanner = Scanner(search_target='upnp:rootdevice')
scanner.discover()
all_types_of_devices = scanner.discovered_devices

Testing

pytest tests/

Code Standard

Roku-Scanner follows PEP 8 standard.

Versioning

Roku-Scanner uses SemVer for versioning. For the versions available, see the tags on this repository.

Authors

  • Christian Cecilia - Initial work

See also the list of contributors who participated in this project.

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

roku-scanner-1.0.1.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

roku_scanner-1.0.1-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file roku-scanner-1.0.1.tar.gz.

File metadata

  • Download URL: roku-scanner-1.0.1.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.0

File hashes

Hashes for roku-scanner-1.0.1.tar.gz
Algorithm Hash digest
SHA256 ace2a2ae5ba802f9a184ed23c2730725c2ad21cb50fb03a674131df258002f7b
MD5 fd6219a2437b3d7868ce24d2721eb9d6
BLAKE2b-256 dd743161417a80d937c156adc52ddc4605151e649263d84cd6f3298c17087506

See more details on using hashes here.

File details

Details for the file roku_scanner-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: roku_scanner-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.0

File hashes

Hashes for roku_scanner-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c19bcbcb05ec0152b8347e73a2aa8a8a24c6d7576423bff9631579ad2588ef28
MD5 4cad81a64f6a0043686f4b1566b9630e
BLAKE2b-256 43e6eb3436d751aa1a166af8cc790c4153d0f88bd32d11182001abbcb974f7a0

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