A .netstandard2 MPD client in C#.
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.
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();
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.
When you are done, disconnect.
await client.DisconnectAsync();
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
- Queue/playlist - deprecated
- Database/list - deprecated
- Connection/kill - not recommended
- Connection/close - not recommended
- 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?
- Find best method to do this
- Write some tests
- Write some more tests
- Code documentation
- Real readme
- Usage examples
- Connection errors handling
- Response parsing
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