扫描LAN中的任何Roku设备并获取设备、应用程序、activeapp和播放器信息。

roku-scanner的Python项目详细描述


Roku扫描仪1.0.4

扫描LAN以查找任何连接的Roku并返回可用的设备信息。在

先决条件

安装

pip3 install roku-scanner

使用

CLI

^{pr2}$

选项

JSON格式的设备数据输出。在

python3 -m roku_scanner --json

漂亮的打印JSON。只能与json标志一起使用。在

python3 -m roku_scanner --json --pretty

增加发现搜索时间的超时。默认值为2秒。建议使用少于10秒的时间。在

python3 -m roku_scanner --timeout 5

将搜索目标更改为针对所有设备,而不仅仅是Roku设备。这将导致将非roku设备添加到发现数据中。与现在一样(1.0.4),对于非Roku设备,只返回发现数据。在

python3 -m roku_scanner --search-target-all

详细日志记录

python3 -m roku_scanner --verbose

从输出中排除数据。在

python3 -m roku_scanner --exclude device-info

排除选项

  • 设备信息
  • 应用程序
  • 活动应用程序
  • 媒体播放器

输出示例

导入示例

发现和设备数据获取

发现Roku并获取他们的设备数据。在

fromroku_scanner.scannerimportScannerfromroku_scanner.rokuimportRokuscanner=Scanner()scanner.discover()found_devices=scanner.discovered_devicesfordeviceinfound_devices:roku_location=device.get('LOCATION')roku=Roku(location=roku_location,discovery_data=device)roku.fetch_data()detailed_device_data=roku.dataprint(detailed_device_data)

JSON

正在获取JSON格式的设备数据。在

fromroku_scanner.scannerimportScannerfromroku_scanner.rokuimportRokuscanner=Scanner()scanner.discover()found_devices=scanner.discovered_devicesfordeviceinfound_devices:roku_location=device.get('LOCATION')roku=Roku(location=roku_location,discovery_data=device)roku.fetch_data()json_data=roku.as_json()

XML

正在获取XML格式的设备数据。在

fromroku_scanner.scannerimportScannerfromroku_scanner.rokuimportRokuscanner=Scanner()scanner.discover()found_devices=scanner.discovered_devicesfordeviceinfound_devices:roku_location=device.get('LOCATION')roku=Roku(location=roku_location,discovery_data=device)roku.fetch_data()xml_data=roku.as_xml()

在扫描仪中搜索目标

将scanner的搜索目标更改为搜索所有设备,这将使用UPnP返回Roku设备和任何其他设备

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

测试

pytest tests/

规范标准

Roku扫描仪遵循PEP 8标准。在

版本控制

Roku扫描仪使用SemVer进行版本控制。有关可用版本,请参阅tags on this repository。在

作者

  • Christian Cecilia-初始工作

另请参阅参与本项目的contributors人员名单。在

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java使图像以正确的速度在屏幕上移动,以适应所有显示   内存Java分配:从预先存在/分配的池中分配对象   java这种书写方式?   Java正则表达式查找字符串的开头   java是否可以创建一个类来处理安卓中的所有日志代码(例如log.d(TAG,message))   如何使用Selenium和java单击WebTable任意页面上的WebElement   java解析字符串中的文件名   java刷新JTree内容   java如何覆盖RequestMappingHandler   爪哇数石头、布、剪刀赢了多少   struts中的java无效令牌   swing JTree,优化算法,Java   java Tomcat和SSL:密钥库格式无效