Giter VIP home page Giter VIP logo

nvidia_shield_remote's Introduction

nvidia_shield_remote

Python class for controlling and querying Nvidia Shield over a network

Prerequisites

Python 3.6 or higher with python-adb installed
    Install Python

    Download and install Python from here

    Install python-adb
    pip install adb

Android Debug Bridge (adb) installed on your computer
    Download the install for ADB here.
Nvidia Shield in Developer Mode with Network Debugging turned on
    Turn on developer mode
    Settings → About → Build (click Build 7 times - "You are now a developer" message will pop up)

    Turn on Network debugging
    Settings → Developer Options → Network debugging

The DNS name (recommended) or IP address and the debug port of your Nvidia Shield
    Get the DNS name
    The DNS name is usually just the Device name of your Shield. Unless you have changed it, it is SHIELD.
    The device name is found at Settings → About → Device name

    Get the IP address and debug port
    Settings → Developer Options → Network debugging
    When you select this option the IP address and port will be shown
Public and private adb keys
    adb connect SHIELD:5555 # use the DNS name (or IP address) and Port from the previous step

    A message will pop up on your Shield asking you to confirm the connection.
    Files adbkey and adbkey.pub will be added to the .android directory of your home folder

        Linux/Mac: ~/.android
        Windows: /users/<username>/.android

    Copy these two files to the directory containing nvidia.py

Sample code

import nvidia
device = nvidia.shield( 'SHIELD:5555' ) # device name (or IP address) and port

if device.get_power() == 'Asleep':
	device.press( 'power' ) # wake the Shield
device.press( 'home' ) # press the home button
device.launch( 'hbo' ) # launch HBO Now app
	
device.get_current_app()
#	 -------> ('com.zynga.boggle', 'com.zynga.scramble.ui.game.ScrambleGameActivity', None)
device.add_app( 'boggle', 'com.zynga.boggle' )
device.launch( 'boggle' )
device.get_current_app()
#	 -------> ('com.zynga.boggle', 'com.zynga.scramble.ui.game.ScrambleGameActivity', 'boggle')

Usage

nvidia.shield has the following methods:

Press a remote control button

press( button )

    button is one of: power, sleep, wake, home, back, search, up, down, left, right, center, volume up, volume down, rewind, ff, play/pause, previous, next

Launch an app (or switch to it if it's already running)

launch( app )

    app is one of: hbo, prime, music, youtube, ted, games, hulu, netflix, youtubetv, disney, twitch, plex, kodi, cbs, pbs, amazonmusic, spotify, pandora or any app added with add_app()

Get the current power state of the device

get_power()

    Returns the current power state, usually Awake or Asleep

Get the currently running app

get_current_app()

    Returns a tuple containing the package name, activity, and app pretty name of the current app

    Note: If the app is not a known app the app pretty name will be None. See launch() for a list of known apps.

Get installed app package names

get_packages()

    Returns a list of the package names of all installed apps

Add app to launchable apps

add_app( app, package )

    app is a string to be used in subsequent calls to launch
    package is the package name of the app, e.g. com.hbo.hbonow

    Note: You can get the current app's package name with get_current_app() or a list of package names with get_packages()

Type text (simulate a keyboard)

type( text )

    Type text into the current app or text field.

    Note: This presently only works in the top-level search, not in any apps, so it is of very limited use.


Questions, feedback, bug reports, and feature requests are all welcome.

nvidia_shield_remote's People

Contributors

sdnick484 avatar stefan-sherwood avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

nvidia_shield_remote's Issues

Generic App List

Would it be possible to add all the apps to self.apps, that are installed on the shield? You can probably create that list at the start, by sending certain requests to the shield.

It is an issue for me, that only the apps, that you listed manually, can be accessed.

No module named 'nvidia'

I think I've done everything in the guide and I always get this error. Is this common? Does it mean something isn't installed right? Is there a pip install Nvidia I'm missing? I would really like to get this working for some smart home automation using my own voice assistant!

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.