diff options
author | Max Kellermann <max@duempel.org> | 2008-10-14 22:38:14 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-10-14 22:38:14 +0200 |
commit | a3e3d2c9506d17b3e19e205535ec263ee75178c9 (patch) | |
tree | 3e93ea6ae33dba8a8f5e12e34629366dcdd7fdb7 /src/storedPlaylist.c | |
parent | 30c86d8ae64ae46ba3bcb1c63e867789feab6dc4 (diff) | |
download | mpd-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/storedPlaylist.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/storedPlaylist.c b/src/storedPlaylist.c index 3d5b8286f..fb0027599 100644 --- a/src/storedPlaylist.c +++ b/src/storedPlaylist.c @@ -24,6 +24,7 @@ #include "utils.h" #include "ls.h" #include "database.h" +#include "idle.h" #include "os_compat.h" static ListNode *nodeOfStoredPlaylist(List *list, int idx) @@ -192,6 +193,7 @@ static int moveSongInStoredPlaylist(List *list, int src, int dest) } } + idle_add(IDLE_STORED_PLAYLIST); return 0; } @@ -212,6 +214,8 @@ moveSongInStoredPlaylistByPath(const char *utf8path, int src, int dest) result = writeStoredPlaylistToPath(list, utf8path); freeList(list); + + idle_add(IDLE_STORED_PLAYLIST); return result; } @@ -231,6 +235,8 @@ removeAllFromStoredPlaylistByPath(const char *utf8path) return PLAYLIST_RESULT_ERRNO; while (fclose(file) != 0 && errno == EINTR); + + idle_add(IDLE_STORED_PLAYLIST); return PLAYLIST_RESULT_SUCCESS; } @@ -262,6 +268,8 @@ removeOneSongFromStoredPlaylistByPath(const char *utf8path, int pos) result = writeStoredPlaylistToPath(list, utf8path); freeList(list); + + idle_add(IDLE_STORED_PLAYLIST); return result; } @@ -299,6 +307,8 @@ appendSongToStoredPlaylistByPath(const char *utf8path, struct song *song) playlist_print_song(file, song); while (fclose(file) != 0 && errno == EINTR); + + idle_add(IDLE_STORED_PLAYLIST); return PLAYLIST_RESULT_SUCCESS; } @@ -325,5 +335,6 @@ renameStoredPlaylist(const char *utf8from, const char *utf8to) if (rename(from, to) < 0) return PLAYLIST_RESULT_ERRNO; + idle_add(IDLE_STORED_PLAYLIST); return PLAYLIST_RESULT_SUCCESS; } |