http get/post commands for quick mpd play/pause toggle?

Suggestions/requests/ideas for RuneAudio core features and functions

http get/post commands for quick mpd play/pause toggle?

Postby waves » 16 Jan 2015, 14:19

Sometimes a user may want to toggle play/pause as quickly as possible. With a smartphone it takes some time to load RA in the browser and then click the play button. I request something quicker. The android app Tasker can silently send http get or post commands at the click of a shortcut. And chrome for android can save a shortcut to a specific website adress.

Is there already some post/get command or url parameter I can pass to RA to in one step quickly toggle play/pause without waiting for and interacting with the GUI? For example 192.168.0.5/toggle

If not then I request that feature.

There are ways to do this with other tools (buy JuiceSSH tasker plugin and set tasker to silently SSH in and send "mpc toggle" on a shortcut click). But I think such a quick toggle feature would be useful to have built into RA.
waves
 
Posts: 125
Joined: 31 Dec 2014, 10:33

Re: http get/post commands for quick mpd play/pause toggle?

Postby skrodahl » 16 Jan 2015, 16:27

There's another thread in the forum discussing just this:
control-rune-from-android-without-webui-t434.html

The MPD playback commands can be found here:
http://www.musicpd.org/doc/protocol/pla ... mands.html

Using this information would give you the following URLs for pause and play:
PAUSE: http://runeaudio.local/command/?cmd=pause%201
PLAY: http://runeaudio.local/command/?cmd=pause%200

The %20 at the end is a whitespace, the command is <pause {option}>", where <option> is 0 or 1. The string "pause 1" in an URL would then be "pause%201".

Hope this helps.
-skrodahl

|| Audiobah TPA3116 || || ProJect Debut Carbon Espirit DC || / RaspBerry Pi / HifiBerry DAC ||
User avatar
skrodahl
Moderator
 
Posts: 160
Joined: 27 Jan 2014, 10:08
Location: Sweden

Re: http get/post commands for quick mpd play/pause toggle?

Postby waves » 17 Jan 2015, 01:56

That helps.

Note to anyone else looking to do the same thing through Tasker in Android: the mpd pause command requires an alternating parameter (i.e. "pause 1" or "pause 0" to set pause on or off) so to toggle pause with one shortcut we need to make a Tasker task with several actions:
- http get 192.168.101.4/command/?cmd=status
- split the returned variable %HTTPD (use "state:" and "song:" as splitters)
- http get 192.168.101.4/command/?cmd=pause 1 if the split result matches *play* , else pause 0
waves
 
Posts: 125
Joined: 31 Dec 2014, 10:33

Re: http get/post commands for quick mpd play/pause toggle?

Postby skrodahl » 18 Jan 2015, 14:29

The MPD docs say that using the pause command without an option is depreciated. I found that it works without the option though, it might make your tasker commands easier.

Although... If the playback is stopped, the pause command does nothing at all. You might want to do a check for that state as well, and send the play command.
-skrodahl

|| Audiobah TPA3116 || || ProJect Debut Carbon Espirit DC || / RaspBerry Pi / HifiBerry DAC ||
User avatar
skrodahl
Moderator
 
Posts: 160
Joined: 27 Jan 2014, 10:08
Location: Sweden

Re: http get/post commands for quick mpd play/pause toggle?

Postby ACX » 18 Jan 2015, 17:37

In the future API we are designing we'll probably add a custom "playpause" command that it's smart enough to detect the state itself and perform consequently, without having to worry from the client side.
User avatar
ACX
RuneAudio co-founder
 
Posts: 1693
Joined: 29 Nov 2013, 02:25
Location: Udine, Italy

Re: http get/post commands for quick mpd play/pause toggle?

Postby waves » 19 Jan 2015, 14:56

waves
 
Posts: 125
Joined: 31 Dec 2014, 10:33

Re: http get/post commands for quick mpd play/pause toggle?

Postby antipiot » 02 Mar 2017, 10:17

Hello mates,

New user of mpd, and http commands, I followed this thread to get a current playlist being played or paused, but I wanted something else and couldn't find anything in the mpd documetation, google or I don't know how to write the comment:-/

I wanted to get a playlist "calme" being played with an http command.

May you please help me? Thanks in advance!
antipiot
 
Posts: 3
Joined: 02 Mar 2017, 10:09

Re: http get/post commands for quick mpd play/pause toggle?

Postby waves » 04 Mar 2017, 02:13

waves
 
Posts: 125
Joined: 31 Dec 2014, 10:33

Re: http get/post commands for quick mpd play/pause toggle?

Postby hondagx35 » 04 Mar 2017, 02:28

User avatar
hondagx35
 
Posts: 3042
Joined: 11 Sep 2014, 22:06
Location: Germany

Re: http get/post commands for quick mpd play/pause toggle?

Postby antipiot » 05 Mar 2017, 10:01

antipiot
 
Posts: 3
Joined: 02 Mar 2017, 10:09

support RuneAudio Donate with PayPal

Next

Return to Feature request

Who is online

Users browsing this forum: No registered users and 8 guests