async def discover(ctx):
    """Discover supported devices."""
    TIMEOUT = 5

    async def print_discovered(dev):
        pretty_name = "%s - %s" % (dev.name, dev.model_number)

        click.echo(click.style("\nFound %s" % pretty_name, bold=True))
        click.echo("* API version: %s" % dev.version)
        click.echo("* Endpoint: %s" % dev.endpoint)
        click.echo("  Services:")
        for serv in dev.services:
            click.echo("    - Service: %s" % serv)
        click.echo("\n[UPnP]")
        click.echo("* URL: %s" % dev.upnp_location)
        click.echo("* UDN: %s" % dev.udn)
        click.echo("  Services:")
        for serv in dev.upnp_services:
            click.echo("    - Service: %s" % serv)

    click.echo("Discovering for %s seconds" % TIMEOUT)
    await Discover.discover(TIMEOUT, ctx.obj["debug"] or 0, callback=print_discovered)
async def discover ( ctx ) : TIMEOUT = 5 async def print_discovered ( dev ) : pretty_name = "%s - %s" % ( dev . name , dev . model_number ) click . echo ( click . style ( "\nFound %s" % pretty_name , bold = True ) ) click . echo ( "* API version: %s" % dev . version ) click . echo ( "* Endpoint: %s" % dev . endpoint ) click . echo ( "  Services:" ) for serv in dev . services : click . echo ( "    - Service: %s" % serv ) click . echo ( "\n[UPnP]" ) click . echo ( "* URL: %s" % dev . upnp_location ) click . echo ( "* UDN: %s" % dev . udn ) click . echo ( "  Services:" ) for serv in dev . upnp_services : click . echo ( "    - Service: %s" % serv ) click . echo ( "Discovering for %s seconds" % TIMEOUT ) await Discover . discover ( TIMEOUT , ctx . obj [ "debug" ] or 0 , callback = print_discovered )
Discover supported devices.