Scans LAN for any Roku devices and fetches device, app, active-app, and player information.
Project description
Roku-Scanner 1.0.4
Scans LAN for any connected Roku's and returns available device information.
Prerequisites
- Python3.8+
- PIP - should be installed with python, if not here
Installation
pip3 install roku-scanner
Usage
CLI
python3 -m roku_scanner
Options
Device data output in JSON.
python3 -m roku_scanner --json
Pretty print JSON. Can only be used with json flag.
python3 -m roku_scanner --json --pretty
Increasing timeout on discovery search time. Default is 2 secs. It's advised to use a time less than 10 secs.
python3 -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.4) only discovery data is returned for non Roku devices.
python3 -m roku_scanner --search-target-all
Verbose Logging
python3 -m roku_scanner --verbose
Excluding data from output.
python3 -m roku_scanner --exclude device-info
Exclusion Options
- device-info
- apps
- active-app
- media-player
Output Examples
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()
xml_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
Built Distribution
File details
Details for the file roku-scanner-1.0.4.tar.gz
.
File metadata
- Download URL: roku-scanner-1.0.4.tar.gz
- Upload date:
- Size: 10.5 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 62010b04a36fbf843fb6cfd7c6969fc4540a7dfd2c3fd4394c4a200433c0798d |
|
MD5 | d7b6eaba8a7bb7ef68f7c9b2a2338c52 |
|
BLAKE2b-256 | d018a5e2de62df61219e53332405e901fd0aac9ce7eaec8f606472f1d287a2e8 |
File details
Details for the file roku_scanner-1.0.4-py3-none-any.whl
.
File metadata
- Download URL: roku_scanner-1.0.4-py3-none-any.whl
- Upload date:
- Size: 11.2 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | e81d8ce8f719185778f42983f78b4bb4b4df10e86f1841a57e2aaf5e0ee2f32e |
|
MD5 | 94a4e6c48b94b3711e8a1096cc865743 |
|
BLAKE2b-256 | ba21adb4c694c2ddad06b04d1515ef51737f39c75c1ca37f8cd152b09435fcc8 |