Module mpdpopm::clients

source ·
Expand description

mpd clients and associated utilities.

Introduction

This module contains basic types implementing various MPD client operations (cf. the mpd protocol). Since issuing the “idle” command will tie up the connection, MPD clients often use multiple connections to the server (one to listen for updates, one or more on which to issue commands). This modules provides two different client types: Client for general-purpose use and IdleClient for long-lived connections listening for server notifiations.

Note that there is another idiom (used in libmpdel, e.g.): open a single connection & issue an “idle” command. When you want to issue a command, send a “noidle”, then the command, then “idle” again. This isn’t a race condition, as the server will buffer any changes that took place when you were not idle & send them when you re-issue the “idle” command. This crate however takes the approach of two channels (like mpdfav).

Structs

  • General-purpose mpd client: “general-purpose” in the sense that we send commands through it; the interface is narrowly scoped to this program’s needs.
  • A description of the current track, suitable for our purposes (as in, it only tracks the attributes needed for this module’s functionality).
  • MPD client for “idle” connections.
  • MPD connections talk the same protocol over either a TCP or a Unix socket.

Enums

  • An MPD client error
  • Enumerated list of MPD operations; used in Error::Protocol to distinguish which operation it was that elicited the protocol error.
  • The MPD player itself can be in one of three states: playing, paused or stopped. In the first two there is a “current” song.

Traits

  • A trait representing a simple, textual request/response protocol like that employed by MPD: the caller sends a textual command & the server responds with a (perhaps multi-line) textual response.

Functions

  • Quote an argument by backslash-escaping “ & \ characters

Type Aliases