Skip to main content

ampd - Asynchronous MPD client library

Communicate with a Music Player Daemon server using asyncio.

Connection is established by a client object. Requests (MPD commands) are generated by executor objects, and are awaited for in asyncio coroutines. Each client has a root executor, and sub-executors can be constructed for grouping related requests.

Tasks

An AMPD task is an asyncio coroutine decorated by @ampd.task. The decorator ensures that the task is immediately scheduled for execution, and that cancellation (e.g., on close()ing the executor) is considered normal termination:

@ampd.task
async def task_example():
    ...
    reply = await executor.request1(a, b)
    ...
    reply = await executor.request2()
    ...

The request can be:

a. An MPD command (other than idle or noidle). Returns when the server's reply arrives:

    await executor.play(5)
    reply = await executor.status()

b. Idle request:

    reply = await executor.idle(event_mask, timeout=None)

This emulates MPD's idle command, with some improvements. The timeout is given in seconds. Possible event flags are:

  • Event.<SUBSYSTEM> (in uppercase) or ANY to match any subsystem.
  • Event.CONNECT - client is connected to server.
  • Event.IDLE - client is idle.

Returns the mask of events which actually occurred, or Event.TIMEOUT if timeout occurred.

c. Command list: executor.command_list(iterable).

Metadata

Release files for ampd 0.2.12

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

Source distribution (sdist)

Source distribution for ampd 0.2.12
File Size Uploaded Provenance Actions
ampd-0.2.12.tar.gz 12.7 kB Without provenance Details for ampd-0.2.12.tar.gz

Release files / ampd-0.2.12.tar.gz

Download URL ampd-0.2.12.tar.gz
Size 12.7 kB
Tags Source
SHA-256 checksum
How to use checksums
dd804e97d0c707f91964687ce3070910275536caf1053cf6401f8251d6061afa
BLAKE2b-256 checksum
How to use checksums
615cfe90428aca9c09360bb5930e67f21a93498670d63c971b3afc54a9161808
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.4.2 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.2

Security for ampd 0.2.12

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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