roku = Roku('192.168.1.107') app = next((a for a in roku.apps if 'plex' in a.name.lower()), None) if app: app.launch() time.sleep(20) for i in range(100): roku.volume_down() for i in range(14): roku.volume_up() roku.down() time.sleep(2) roku.select() time.sleep(2) roku.up() time.sleep(1) roku.up() time.sleep(1) roku.right() time.sleep(1) roku.right() time.sleep(1) roku.select() time.sleep(1) roku.down() time.sleep(1) roku.select() time.sleep(1) roku.right() time.sleep(1)
def roku_command(remote_command): delay = 1 #connect to roku #enter your rokus ip address to test roku = Roku('192.168.0.110') #remote command is place holder for list of commands from remote to dashboard #remote_command=['triangle'] #if circle shape is registered on remote than launch the most recent episode of a users favorite show. #In this case Silicon Valley. for i in remote_command: if i == 'circle': for light in lights: light.brightness = 254 light.xy = [.1, .1] hbo = roku["HBO GO"] hbo.launch() sleep(6 * delay) roku.down() sleep(delay) roku.right() sleep(delay) roku.right() sleep(delay) roku.select() sleep(3 * delay) roku.select() sleep(2 * delay) roku.select() sleep(delay) # roku.up() # sleep(delay) # roku.left() # sleep(delay) # roku.down() # sleep(delay) # roku.left() # sleep(delay) # roku.select() # sleep(2*delay) # roku.right() # sleep(delay) # roku.select() # sleep(2*delay) # roku.select() # sleep(2*delay) for light in lights: light.brightness = 100 if i == "left_swipe": #move cursor left roku.left() if i == "up_swipe": roku.up() if i == "down_swipe": roku.down() if i == "right_swipe": #move curser right roku.right() if i == "triangle": print "test" b.set_light([2, 3], 'on', True) # Prints if light 1 is on or not b.get_light(2, 'on') # Set brightness of lamp 1 to max b.set_light(2, 'bri', 254) # Set brightness of lamp 2 to 50% b.set_light(3, 'bri', 254) for light in lights: light.brightness = 254 light.xy = [.9, .7] #enter search commands roku.search() if i == "square": roku.info() if i == 'quad_diagonal_1': b.set_light(1, 'on', False) return True
from roku import Roku rokuls = Roku.discover(timeout=10); print(rokuls); ip = input('IP: '); roku = Roku(ip); while True: remoteinput = input('Remote Input (i.e. down, up, left, right, back, home, ok): '); if remoteinput == 'down': roku.down(); elif remoteinput == 'up': roku.up(); elif remoteinput == 'left': roku.left(); elif remoteinput == 'right': roku.right(); elif remoteinput == 'back': roku.back(); elif remoteinput == 'home': roku.home(); elif remoteinput == 'ok': roku.select(); else: print('Not a valid command.');
print("Connecting...") ###################################################################################### try: roku = Roku(userInput) # Channel shortcuts sling = roku['Sling TV'] netflix = roku['Netflix'] amazon = roku['Prime Video'] nbc = roku['NBC News'] hbo = roku['HBO Max'] # Keybindings keyboard.add_hotkey(72, lambda: roku.up()) keyboard.add_hotkey(75, lambda: roku.left()) keyboard.add_hotkey(77, lambda: roku.right()) keyboard.add_hotkey(80, lambda: roku.down()) keyboard.add_hotkey(14, lambda: roku.backspace()) keyboard.add_hotkey(28, lambda: rokuSubmitText()) def rokuHome(): roku.home() def rokuSearch(): roku.search() def rokuBack(): roku.back()