Giter VIP home page Giter VIP logo

roku-scanner's Introduction

Roku-Scanner 1.0.4

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

Prerequisites

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.

roku-scanner's People

Contributors

ccecilia avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

roku-scanner's Issues

Set up git hooks

Set up git hooks for running MyPy and unit tests to help workflow.

Missing tests

Add unit tests. Preferably using PyTest in conjunction coverage.

Add exclusions for output

Add functionality for excluding data from output. Probably under a --exclude CLI arg.

  1. add new arg in arg parser in main.py, named --exclude, that accepts a list of excluded ECP data.
  2. check flag where and exclude any data from the output.

Tag functions with doc strings

Tag the entire project with docstrings in the following format.

"""
{description}
:param {param name}: {param description}
:return: {any return value}
"""

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.