REST API support?
Is there a way to communicate with the ympd server using regular HTTP requests (not websockets)? e.g. I want to send MPD_API_SET_PAUSE without needing to load the ympd frontend - so I can quickly play/pause.
e.g. http://raspberrypi.local:2938/?command=MPD_API_SET_PAUSE
Can't you just use a direct MPD connection?
Yeah, I mean this is up for @notandy to decide, but IMHO this is not in the scope for this project.
If you really need a REST API for mpd for some reason and can't connect directly to it, you might want to implement this as a separate project.
I figured that it would be a bit more trivial to piggyback on ympd's existing web socket support than writing a REST API from scratch.
@kurt-vd It would be useful for mobile devices that don't have native MPD capabilities. E.g. iOS devices require an MPD app to talk mpd. Using ympd to send a simple pause/play command is a bit painful because it requires the entire web app to load.
Hey,
@kurt-vd It would be useful for mobile devices that don't have native MPD capabilities.
So you're looking at devices without dedicated MPD app, and want to control MPD via HTTP.
E.g. iOS devices require an MPD app to talk mpd. Using ympd to send a simple pause/play command is a bit painful because it requires the entire web app to load.
Are you looking for a (simple) CGI script that shows you some buttons, which is easier to load, and that controls MPD from simple HTTP requests? Without browsing the music collection and play queue, that looks 'trivial' to write.
The moment that you want feedback into the browser, ympd's websocket is the better alternative. I understand you're not looking for feedback into the browser.
Kurt
Technically, it is very easy to parse all the websocket webclient -> ympd commands via http-post instead of websockets. But as @kurt-vd said, you will missing the websocket callbacks. For now websockets are the only way to communicate with ympd, but I could imagine that ympd implements some fallback rest/ajax support for browser with problems handling websockets.
@HyShai did you ever find something that worked like this? Im looking to control MPD connections to Airplay devices via HA-BRIDGE? Basically use an echo dot to do multi room audio.
I'm working on an mpd to mqtt bridge. This is not HTTP rest, but works for me to integrate mpd control in my home automation
Technically, it is very easy to parse all the websocket webclient -> ympd commands via http-post instead of websockets. But as @kurt-vd said, you will missing the websocket callbacks. For now websockets are the only way to communicate with ympd, but I could imagine that ympd implements some fallback rest/ajax support for browser with problems handling websockets.
I would also welcome such a feature and I would not need any kind of feedback to the client.