This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Asynchronous MPD client library

Project Description

Uses python asyncio for asynchronous communication with a Music Player Daemon server.

Connection is established by a client object. Requests (MPD commands) are executed in asyncio coroutines, referred to here as “tasks”. Requests are generated by an executor object. Each client has a root executor, and sub-executors can be constructed (for grouping related tasks).

Tasks

An AMPD task is, essentially, an asyncio coroutine. The @task decorator makes the coroutine execute immediately via asyncio.ensure_future. In addition, it wraps it so cancellation and disconnect exceptions are considered normal termination:

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

The request can be:

  1. An MPD command [1] (other than idle and noidle). Returns when the server’s reply arrives:

    await executor.play(5)
    reply = await executor.status()
    
  2. 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.

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

[1]For MPD commands and subsystems see http://www.musicpd.org/doc/protocol/command_reference.html
Release History

Release History

This version
History Node

0.2.6

History Node

0.2.4

History Node

0.2.3

History Node

0.2.2

History Node

0.2.1

History Node

0.2.0

History Node

0.1.10

History Node

0.1.8

History Node

0.1.7

History Node

0.1.2

History Node

0.1.1b9

History Node

0.1.1b8

History Node

0.1.1b4

History Node

0.1.1b3

History Node

0.1.1b1

History Node

0.1.1b0

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
ampd-0.2.6.tar.gz (11.0 kB) Copy SHA256 Checksum SHA256 Source May 8, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting