Skip to main content

Tools for using asyncio to control a Second Life viewer over the LEAP protocol

Project description

outleap

codecov

A Python library using asyncio to control a Second Life viewer over the LEAP protocol.

See https://bitbucket.org/lindenlab/leap/src/main/ for more details on LEAP.

Installing

pip install outleap, or pip install -e . to install from source.

Usage

Look in the "examples" directory.

You can run a LEAP script with your_viewer --leap some_script.py if you have the executable bit set.

import asyncio
import sys

from outleap import LEAPClient, LEAPProtocol, LLViewerControlAPI, connect_stdin_stdout


async def amain():
    # Create a client speaking LEAP over stdin/stdout and connect it
    reader, writer = await connect_stdin_stdout()
    async with LEAPClient(LEAPProtocol(reader, writer)) as client:
        # Use our typed wrapper around the LLViewerControl LEAP API
        viewer_control_api = LLViewerControlAPI(client)
        # Ask for a config value and print it in the viewer logs
        print(await viewer_control_api.get("Global", "StatsPilotFile"), file=sys.stderr)


loop = asyncio.get_event_loop_policy().get_event_loop()
loop.run_until_complete(amain())

What viewers does LEAP even work in?

Due to the fact that LEAP has only historically been used internally for testing, or for integration with the official viewer's updater, many viewers have disabled LEAP both intentionally or accidentally.

The code in the upstream viewer also appears to refuse to launch LEAP scripts if the updater isn't present, which I don't entirely understand. I can't compile it to check.

Does it work in Firestorm?

No, the code to launch LEAP scripts is commented out. If you do your own build with those lines uncommented it'll work fine.

Does it work in Alchemy?

Probably not, and definitely not on Linux. Alchemy does the same SL updater presence checks as upstream before attempting to launch LEAP scripts, which I imagine wouldn't succeed. Haven't tried.

Does it work in LL's official viewer?

Yeah, probably.

Does it work in <other viewer>?

No, probably not.

Credits

The project scaffolding is based on code from https://github.com/MatthieuDartiailh/bytecode

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

outleap-0.1.0.tar.gz (20.8 kB view hashes)

Uploaded Source

Built Distribution

outleap-0.1.0-py3-none-any.whl (14.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page