ympd icon indicating copy to clipboard operation
ympd copied to clipboard

REST API support?

Open HyShai opened this issue 11 years ago • 8 comments

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

HyShai avatar Apr 02 '15 17:04 HyShai

Can't you just use a direct MPD connection?

kurt-vd avatar Apr 28 '15 12:04 kurt-vd

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.

ajs124 avatar Apr 28 '15 19:04 ajs124

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.

HyShai avatar Apr 28 '15 21:04 HyShai

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

kurt-vd avatar Apr 29 '15 18:04 kurt-vd

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.

notandy avatar May 01 '15 11:05 notandy

@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.

1liminal1 avatar Apr 17 '17 07:04 1liminal1

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

kurt-vd avatar Sep 05 '17 19:09 kurt-vd

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.

heiderich avatar Jul 22 '19 20:07 heiderich