Skip to main content

LDPX - LDPlayer Automation Toolkit

A powerful Python abstraction layer and CLI tool for controlling LDPlayer Android emulator instances. Manage multiple emulators programmatically with comprehensive batch operation support.

Python Version License

Features

  • 🐍 Python API: Complete wrapper for all ldconsole commands
  • 🚀 Batch Operations: Execute commands across multiple instances simultaneously
  • 🔍 Auto-Discovery: Automatically detect LDPlayer installations
  • ⚙️ Configuration Management: Read and modify emulator configs programmatically
  • 🎯 Flexible Targeting: Select instances by name, index, list, or lambda filter
  • 💾 Smart Caching: LFU cache for configuration files with automatic staleness detection
  • 📝 Type-Safe: Full type hints and comprehensive docstrings
  • 🛠️ CLI Tool: Intuitive command-line interface built with Click

Installation

Using uv (recommended)

# With CLI support
uv add ldpx[click]

# API only
uv add ldpx

Using pip

# With CLI support
pip install ldpx[click]

# API only
pip install ldpx

Quick Start

Auto-Discovery

# Discover LDPlayer installation automatically
ldpx discover

# Verify configuration
ldpx console query list2

Python API

from ldpx.core.objs.attr import LDAttr
from ldpx.core.objs.console import Console

# Initialize (auto-discover or load from config)
attr = LDAttr.discover()
console = Console(attr)

# Single instance operations
console.launch(name="instance1")
console.installapp(index=0, filename="app.apk")

# Batch operations - by list
console.launch([0, 1, 2])

# Batch operations - by lambda filter
console.launch(instances=lambda x: x.name.startswith('game'))

# Query instances
instances = console.list2()
for inst in instances:
    print(f"{inst['name']}: {inst['id']}")

CLI Usage

# Launch single instance
ldpx console exec launch --name instance1

# Batch launch by indices
ldpx console exec launch -bs "0,1,2"

# Batch launch by lambda filter
ldpx console exec launch -bl "lambda x: x['name'].startswith('game')"

# Install app on multiple instances
ldpx console app installapp --filename app.apk -bs "0,1,2"

# Query instance information
ldpx console query list2
ldpx console query isrunning --name instance1

# Modify instance settings
ldpx console config modify --name instance1 --resolution "1920x1080" --cpu 4 --memory 4096

Command Categories

Query Commands

Get information about emulator instances:

  • list - List all instances (simple format)
  • list2 - List all instances (detailed metadata)
  • list3 - Query single instance details
  • runninglist - List running instances
  • isrunning - Check if instance is running
  • getprop - Get system property value
  • operatelist - List operations for instance
  • operateinfo - Get operation information

Execution Commands

Control emulator lifecycle:

  • launch - Start an emulator instance
  • quit - Stop an emulator instance
  • reboot - Reboot an emulator instance
  • quitall - Stop all running instances
  • add - Create new emulator instance
  • copy - Clone an existing instance
  • remove - Delete an emulator instance
  • rename - Rename an emulator instance

App Management

Manage Android applications:

  • installapp - Install APK file or app by package name
  • uninstallapp - Uninstall app by package name
  • runapp - Launch an app
  • killapp - Stop a running app
  • launchex - Launch app with extended options
  • backupapp - Backup app and its data
  • restoreapp - Restore app and its data

Configuration

Modify emulator settings:

  • modify - Change instance settings (CPU, memory, resolution, device info, etc.)
  • globalsetting - Configure global settings (FPS, audio, etc.)
  • operaterecord - Execute recorded macro/script

File Operations

Transfer files between host and emulator:

  • pull - Download files from emulator
  • push - Upload files to emulator

Simple Commands

Utility commands:

  • rock - Shake the emulator window
  • zoomIn - Zoom in the emulator window
  • zoomOut - Zoom out the emulator window
  • sortWnd - Sort and arrange emulator windows

Batch Operations

Batch operations allow you to execute commands on multiple instances at once.

By Comma-Separated List

# Indices
ldpx console exec launch -bs "0,1,2"

# Names
ldpx console exec launch -bs "instance1,instance2,instance3"

By Lambda Filter

# Filter by name pattern
ldpx console exec launch -bl "lambda x: x['name'].startswith('game')"

# Filter by running status
ldpx console exec quit -bl "lambda x: x['android_started_int'] == 1"

Python API Batch

# List of indices
console.launch([0, 1, 2])

# List of names
console.launch(["instance1", "instance2"])

# Lambda filter
console.launch(instances=lambda x: x['name'].startswith('test'))

# Custom function
console.launch(console_func=lambda c: c.launch(name='specific'))

Configuration Management

from ldpx.ext.obj.leidian import LeidianFile

# Initialize
leidian_file = LeidianFile(attr)

# Get global configuration
global_config = leidian_file.getLeidiansConfig()

# Get instance configuration
instance_config = leidian_file.getLeidianConfig(0)

# Modify and save
instance_config.basicSettings['fps'] = 120
leidian_file.dumpLeidianConfig(instance_config)

Advanced Features

Keyboard Mapping Management

from ldpx.ext.obj.kmp import KMPFile

kmp_file = KMPFile(attr)

# List available mappings
mappings = kmp_file.customizeList()

# Load a mapping
mapping = kmp_file.getCustomize("game_mapping.kmp")

# Modify and save
# ... modify mapping ...
kmp_file.dump("game_mapping.kmp", mapping)

Macro/Script Management

from ldpx.ext.obj.record import RecordFile

record_file = RecordFile(attr)

# List recordings
recordings = record_file.recordList()

# Load a recording
record = record_file.getRecord("automation.record")

# Execute on instance
console.operaterecord(name="instance1", content=record)

Requirements

  • Python 3.12 or higher
  • Windows OS (LDPlayer is Windows-only)
  • LDPlayer installed
  • psutil for process discovery
  • click for CLI (optional)

Configuration

LDPX stores configuration in ~/.ldpx/ld/config.json:

{
    "path": [
        "C:/path/to/LDPlayer",
        "D:/another/installation"
    ]
}

Add paths manually or use ldpx discover for automatic detection.

Documentation

Full API documentation with docstrings is available in the source code. Each module, class, and function includes comprehensive documentation.

Contributing

Contributions welcome! Please ensure:

  • Code follows existing patterns
  • Type hints are included
  • Docstrings are comprehensive
  • Tests pass (when test suite is added)

License

MIT License - see LICENSE file for details

Acknowledgments

  • LDPlayer for providing the ldconsole CLI tool
  • Click framework for CLI capabilities
  • psutil for process management

Support

For issues, questions, or contributions, please visit the project repository.


Note: This tool requires LDPlayer to be installed and is Windows-only due to LDPlayer platform constraints.

Metadata

Release files for ldpx 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ldpx 0.3.0
File Size Uploaded
ldpx-0.3.0.tar.gz 30.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ldpx 0.3.0
File Interpreter ABI Platform
ldpx-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 76.3 kB

Release files / ldpx-0.3.0.tar.gz

Download URL ldpx-0.3.0.tar.gz
Size 30.7 kB
Tags Source
SHA-256 checksum
How to use checksums
2704cdf76e7961819e6a2720e98203049c9be80897f64eb2a4ccd8fd29ee0a45
BLAKE2b-256 checksum
How to use checksums
89bb4d3ec848c4adde480e5c19b0c6b3e831f77a902b38467e2e08f28cb4f361
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2025.

Transparency log

Release files / ldpx-0.3.0-py3-none-any.whl

Download URL ldpx-0.3.0-py3-none-any.whl
Size 45.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
82be2b71f9a6df3d18ba81756dd57d1615651ea3165d29f2ed5a729d9d82acfa
BLAKE2b-256 checksum
How to use checksums
bb867588479df36eb47d3a42d8fde0527c2b5e18684a28f4b2917f7161d40d96
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page