aboutsummaryrefslogtreecommitdiffstats
path: root/src/playlist.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/playlist.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/playlist.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/playlist.c b/src/playlist.c
index b160202bf..3498ae7bb 100644
--- a/src/playlist.c
+++ b/src/playlist.c
@@ -34,6 +34,7 @@
#include "state_file.h"
#include "storedPlaylist.h"
#include "ack.h"
+#include "idle.h"
#include "os_compat.h"
#define PLAYLIST_STATE_STOP 0
@@ -87,6 +88,8 @@ static void incrPlaylistVersion(void)
playlist.version = 1;
}
+
+ idle_add(IDLE_PLAYLIST);
}
void playlistVersionChange(void)
@@ -504,6 +507,8 @@ static void syncPlaylistWithQueue(void)
if (pc.next_song == NULL && playlist.queued != -1) {
playlist.current = playlist.queued;
playlist.queued = -1;
+
+ idle_add(IDLE_PLAYER);
}
}
@@ -951,6 +956,8 @@ void setPlaylistRepeatStatus(bool status)
clearPlayerQueue();
playlist.repeat = status;
+
+ idle_add(IDLE_OPTIONS);
}
enum playlist_result moveSongInPlaylist(int from, int to)
@@ -1123,6 +1130,8 @@ void setPlaylistRandomStatus(bool status)
}
} else
orderPlaylist();
+
+ idle_add(IDLE_OPTIONS);
}
void previousSongInPlaylist(void)
@@ -1219,6 +1228,7 @@ enum playlist_result savePlaylist(const char *utf8file)
while (fclose(fp) && errno == EINTR) ;
+ idle_add(IDLE_STORED_PLAYLIST);
return PLAYLIST_RESULT_SUCCESS;
}