aboutsummaryrefslogtreecommitdiffstats
path: root/src/player_control.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-10-14 22:38:14 +0200
committerMax Kellermann <max@duempel.org>2008-10-14 22:38:14 +0200
commita3e3d2c9506d17b3e19e205535ec263ee75178c9 (patch)
tree3e93ea6ae33dba8a8f5e12e34629366dcdd7fdb7 /src/player_control.c
parent30c86d8ae64ae46ba3bcb1c63e867789feab6dc4 (diff)
downloadmpd-a3e3d2c9506d17b3e19e205535ec263ee75178c9.tar.gz
mpd-a3e3d2c9506d17b3e19e205535ec263ee75178c9.tar.xz
mpd-a3e3d2c9506d17b3e19e205535ec263ee75178c9.zip
command: added command "idle"
"idle" waits until something noteworthy happens on the server, e.g. song change, playlist modified, database updated. This allows clients to keep up to date without polling.
Diffstat (limited to '')
-rw-r--r--src/player_control.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/player_control.c b/src/player_control.c
index e7935f80f..086ef505a 100644
--- a/src/player_control.c
+++ b/src/player_control.c
@@ -21,6 +21,7 @@
#include "log.h"
#include "tag.h"
#include "song.h"
+#include "idle.h"
#include "os_compat.h"
#include "main_notify.h"
@@ -61,6 +62,8 @@ playerPlay(struct song *song)
pc.next_song = song;
player_command(PLAYER_COMMAND_PLAY);
+
+ idle_add(IDLE_PLAYER);
}
void pc_cancel(void)
@@ -71,17 +74,23 @@ void pc_cancel(void)
void playerWait(void)
{
player_command(PLAYER_COMMAND_CLOSE_AUDIO);
+
+ idle_add(IDLE_PLAYER);
}
void playerKill(void)
{
player_command(PLAYER_COMMAND_EXIT);
+
+ idle_add(IDLE_PLAYER);
}
void playerPause(void)
{
- if (pc.state != PLAYER_STATE_STOP)
+ if (pc.state != PLAYER_STATE_STOP) {
player_command(PLAYER_COMMAND_PAUSE);
+ idle_add(IDLE_PLAYER);
+ }
}
void playerSetPause(int pause_flag)
@@ -185,6 +194,8 @@ playerSeek(struct song *song, float seek_time)
if (pc.error == PLAYER_ERROR_NOERROR) {
pc.seekWhere = seek_time;
player_command(PLAYER_COMMAND_SEEK);
+
+ idle_add(IDLE_PLAYER);
}
return 0;
@@ -200,6 +211,8 @@ void setPlayerCrossFade(float crossFadeInSeconds)
if (crossFadeInSeconds < 0)
crossFadeInSeconds = 0;
pc.crossFade = crossFadeInSeconds;
+
+ idle_add(IDLE_OPTIONS);
}
void setPlayerSoftwareVolume(int volume)