Skip to content

feat: MPD server - #487

Draft
ThinkChaos wants to merge 2 commits into
sentriz:masterfrom
ThinkChaos:feat/mpd
Draft

feat: MPD server#487
ThinkChaos wants to merge 2 commits into
sentriz:masterfrom
ThinkChaos:feat/mpd

Conversation

@ThinkChaos

Copy link
Copy Markdown

Hi,

I did this as a proof-of-concept. There's no docs, not enough tests and comments, and what's actually implemented from the MPD API is pretty minimal. So I've marked this as a draft and wanted to get feedback before spending any more time on it.

The end goal for me is to be able to control the jukebox via any MPD client, since the jukebox support of Subsonic clients, is subpar from my experience. Ideally in the end being able to steal the queue from device to device, like is possible on the streaming giants.

Please let me know if this is something you'd be interested in merging. I'm willing to handle maintenance/future issues that pop up.

@ThinkChaos ThinkChaos left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some comments to not forget things, since I took a quick look with fresh eyes.

Comment thread server/mpd/server.go
return c.srv.jukebox.TogglePlay()

case state == "1" || state == "0":
return c.srv.jukebox.SetPlay(state == "0")

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename state to pause to make the comparison clear.

Comment thread server/mpd/server.go
return c.srv.jukebox.SetPlay(state == "0")

default:
return c.newErr(ackErrorArg, fmt.Errorf("play state must be 0 or 1, got: %s", state))

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return c.newErr(ackErrorArg, fmt.Errorf("play state must be 0 or 1, got: %s", state))
return c.newErr(ackErrorArg, fmt.Errorf("pause state must be 0 or 1, got: %s", state))

Comment thread server/mpd/server.go
}

func doCmd(c *client, name string, args *argParser) error {
fmt.Println("->", args.line)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs to be removed/made into a proper log.

Comment thread server/mpd/server.go
)

const (
protocolVersion = "0"

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put something here when enough of the protocol is supported.

@sentriz
sentriz force-pushed the master branch 3 times, most recently from c5b3a1c to 86fd590 Compare May 15, 2024 15:07
@lomereiter

Copy link
Copy Markdown
Contributor

Why make it part of gonic though? It makes more sense to have it as a separate executable, that you can slap on top of any Subsonic-compatible server. This Mopidy plugin is looking for a maintainer, by the way: https://github.com/Prior99/mopidy-subidy

@ThinkChaos

Copy link
Copy Markdown
Author

@lomereiter Having a separate server seems a lot harder, and less optimized, since you can only use the public APIs, not reach for the DB/functions directly. And on top of that you now need to support/test multiple servers, not "just" multiple clients, so MxN vs N.

I am not interested in contributing to Mopidy because I don't want to use it (tried before Gonic FWIW), and because of tech and license reasons.

P.S. please consider how you phrase feedback because it sounds like you're dismissing the thought I put into this by using absolute wording like "it makes more sense", and telling me what to do with my time. Hopefully you can understand :)

@lomereiter

Copy link
Copy Markdown
Contributor

Fair enough, I just stated my opinion: I prefer the Unix way when every tool does one thing well. Sorry it came off as abrasive. And I'm not the maintainer, so it doesn't have much weight anyway.

I didn't say anything about having to support multiple servers, it could be just Gonic, and whoever needs support for other servers is free to contribute - that's how open source is supposed to work. Using public API is overhead indeed, but the benefit is that it's much more stable and should require almost no maintenance. Whereas if you want to consume Gonic as a library, it first needs a refactoring so that more or less stable interfaces are defined for accessing the DB instead of making queries directly from HTTP handlers, as is the case now (see server/ctrlsubsonic).

@maristieuvelonde

Copy link
Copy Markdown

This is a fantastic idea, I would definitely use this!

@sentriz
sentriz force-pushed the master branch 5 times, most recently from 7decea6 to 971d22d Compare November 11, 2025 07:01
lurenyang418 pushed a commit to lurenyang418/gonic that referenced this pull request Mar 23, 2026
@sentriz
sentriz force-pushed the master branch 4 times, most recently from 42aaccf to 6b377e7 Compare April 29, 2026 15:17
@sentriz
sentriz force-pushed the master branch 2 times, most recently from c00760e to 9f706b9 Compare May 22, 2026 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants