Skip to content

Latest commit

 

History

History
101 lines (83 loc) · 2.77 KB

readme.md

File metadata and controls

101 lines (83 loc) · 2.77 KB

mpcCore

A .netstandard2 MPD client in C#.

.NET Build .NET Test

Basically i needed something to talk to MPD for a raspberry pi project. Mpc.NET is a great example, but seems to be dead. Since there is lots of time due to Corona, programming is fun and .net Core is fun - here it is.

Keep in mind this is a really early work in progress.

Basic usage

Connecting

Create a connection with ip and port of your mpd server and use to create a client instance. Default values are 127.0.0.1 for local connection and the standard MPD port 6600.

Connect to the server.

var connection = new MpcCoreConnection("192.168.0.20", "6600");
var client = new MpcCoreClient(connection);
var connected = await client.ConnectAsync();

Sending commands

Send commands via SendAsync(). For example, load a playlist and start playing.

await client.SendAsync(new Commands.Playlist.LoadPlaylist("awesomeplaylistname"));
await client.SendAsync(new Commands.Player.Play());

Each command returns a IMpcCoreResponse<T> with the raw command sent to MPD, a status object with error information and the result depending on the command.

Disconnecting

When you are done, disconnect.

await client.DisconnectAsync();

TODO

Commands

The following commands are currently implemented. Grouping follows the MPD protocol documentation.

  • Player
  • Queue
  • Playlist
  • Status
  • Option
  • Database
  • Sticker
  • Partition
  • Audio output devices
  • Connection
  • Mount commands
  • Reflection
  • Client to client commands
    • subscribe
    • unsubscribe
    • channels
    • readmessages
    • sendmessage

Commands that won't be implemented

  • Queue/playlist - deprecated
  • Database/list - deprecated
  • Connection/kill - not recommended
  • Connection/close - not recommended

Functionality

  • Command list handling
  • More error handling
  • Checking string escaping edgecases
  • Binary response handling
  • Filter handling / construction
  • Config options (Timeout, Password etc)
  • Audio format/settings
  • Authentication
  • Nuget export
  • i18n?

Unittests

  • Find best method to do this
  • Write some tests
  • Write some more tests

Documentation

  • Code documentation
  • Real readme
  • Usage examples

Cleanup

  • Connection errors handling
  • Response parsing

Roadmap

Depending on the level of energy and the endurance of corona, the following things will be done

  • finishing commands
  • cli client
  • test coverage
  • REST api