def main(): sys.stdout.write('Spending 5 seconds discovering local Roku devices...\n') sys.stdout.flush() devices = ssdp.discover(ROKU_ST) rokus = list(filter(lambda d: d.st == ROKU_ST, devices)) others = list(filter(lambda d: d.st != ROKU_ST, devices)) if devices: sys.stdout.write( 'Found {0} devices: {1} Rokus and {2} others.\n' .format(len(devices), len(rokus), len(others)) ) else: sys.stdout.write('Did not find any Rokus on your local network.') if rokus: sys.stdout.write('--> Rokus:\n') for device in rokus: parsed = urlparse(device.location) roku = RokuDevice(parsed.hostname, parsed.port) sys.stdout.write(' * {0}\n'.format(roku)) if others: sys.stdout.write('--> Others:\n') for device in others: sys.stdout.write(' * {0}\n'.format(device.location)) if rokus: sys.stdout.write('Try running ./scan_roku <ip> :)\n')
def main(): sys.stdout.write('Spending 5 seconds discovering local Roku devices...\n') sys.stdout.flush() devices = ssdp.discover(ROKU_ST) rokus = list(filter(lambda d: d.st == ROKU_ST, devices)) others = list(filter(lambda d: d.st != ROKU_ST, devices)) if devices: sys.stdout.write( 'Found {0} devices: {1} Rokus and {2} others.\n'.format( len(devices), len(rokus), len(others))) else: sys.stdout.write('Did not find any Rokus on your local network.') if rokus: sys.stdout.write('--> Rokus:\n') for device in rokus: parsed = urlparse(device.location) roku = RokuDevice(parsed.hostname, parsed.port) sys.stdout.write(' * {0}\n'.format(roku)) if others: sys.stdout.write('--> Others:\n') for device in others: sys.stdout.write(' * {0}\n'.format(device.location)) if rokus: sys.stdout.write('Try running ./scan_roku <ip> :)\n')
def find_roku_on_local_network(): """Get the first RokuDevice discovered on the local network.""" st_header = 'roku:ecp' for device in ssdp.discover(st_header): # non-Roku devices might respond if device.st == st_header: parsed = urlparse(device.location) return RokuDevice(parsed.hostname, parsed.port) return None
def main(): sys.stdout.write('Spending 5 seconds discovering local SSDP devices...\n') sys.stdout.flush() devices = ssdp.discover(ST) if devices: sys.stdout.write('Found {0} devices:\n'.format(len(devices))) for device in devices: sys.stdout.write('--> {0}\n'.format(device)) else: sys.stdout.write( 'Did not find any SSDP devices on your local network.')
def main(): sys.stdout.write('Spending 5 seconds discovering local SSDP devices...\n') sys.stdout.flush() devices = ssdp.discover(ST) if devices: sys.stdout.write( 'Found {0} devices:\n' .format(len(devices)) ) for device in devices: sys.stdout.write('--> {0}\n'.format(device)) else: sys.stdout.write('Did not find any SSDP devices on your local network.')