aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQball Cow <qball@qballcow.nl>2006-04-23 11:10:41 +0000
committerQball Cow <qball@qballcow.nl>2006-04-23 11:10:41 +0000
commit5416d00bcdf7e248a103de9fca017480e5746ea4 (patch)
treeb2493453587b608a8995d83f42b8b12ff8539957
parent8220d3deac0f28e75e580e2f8d29fa2691d8e251 (diff)
downloadmpd-5416d00bcdf7e248a103de9fca017480e5746ea4.tar.gz
mpd-5416d00bcdf7e248a103de9fca017480e5746ea4.tar.xz
mpd-5416d00bcdf7e248a103de9fca017480e5746ea4.zip
Adding of plchangesposid command, this is a stripped down version of the plchanges command, it only sends the pos and id of the changed command. Libmpd allready has support for it, and libmpdclient in libmpd too
git-svn-id: https://svn.musicpd.org/mpd/trunk@4101 09075e82-0dd4-0310-85a5-a0d7c8717e4f
-rw-r--r--src/command.c17
-rw-r--r--src/playlist.c20
-rw-r--r--src/playlist.h2
3 files changed, 39 insertions, 0 deletions
diff --git a/src/command.c b/src/command.c
index 54703ca28..9c13948d6 100644
--- a/src/command.c
+++ b/src/command.c
@@ -84,6 +84,7 @@
#define COMMAND_CROSSFADE "crossfade"
#define COMMAND_URL_HANDLERS "urlhandlers"
#define COMMAND_PLCHANGES "plchanges"
+#define COMMAND_PLCHANGESPOSID "plchangesposid"
#define COMMAND_CURRENTSONG "currentsong"
#define COMMAND_ENABLE_DEV "enableoutput"
#define COMMAND_DISABLE_DEV "disableoutput"
@@ -414,6 +415,21 @@ int handlePlaylistChanges(FILE * fp, unsigned int * permission,
return playlistChanges(fp, version);
}
+int handlePlaylistChangesPosId(FILE * fp, unsigned int * permission,
+ int argArrayLength, char ** argArray)
+{
+ unsigned long version;
+ char * test;
+
+ version = strtoul(argArray[1], &test, 10);
+ if(*test!='\0') {
+ commandError(fp, ACK_ERROR_ARG, "need a positive integer",
+ NULL);
+ return -1;
+ }
+ return playlistChangesPosId(fp, version);
+}
+
int handlePlaylistInfo(FILE * fp, unsigned int * permission,
int argArrayLength, char ** argArray)
{
@@ -970,6 +986,7 @@ void initCommands() {
addCommand(COMMAND_CROSSFADE ,PERMISSION_CONTROL, 1, 1,handleCrossfade,NULL);
addCommand(COMMAND_URL_HANDLERS,PERMISSION_READ, 0, 0,handleUrlHandlers,NULL);
addCommand(COMMAND_PLCHANGES ,PERMISSION_READ, 1, 1,handlePlaylistChanges,NULL);
+ addCommand(COMMAND_PLCHANGESPOSID ,PERMISSION_READ, 1, 1,handlePlaylistChangesPosId,NULL);
addCommand(COMMAND_ENABLE_DEV ,PERMISSION_ADMIN, 1, 1,handleEnableDevice,NULL);
addCommand(COMMAND_DISABLE_DEV ,PERMISSION_ADMIN, 1, 1,handleDisableDevice,NULL);
addCommand(COMMAND_DEVICES ,PERMISSION_ADMIN, 0, 0,handleDevices,NULL);
diff --git a/src/playlist.c b/src/playlist.c
index d122948e5..8eaac641d 100644
--- a/src/playlist.c
+++ b/src/playlist.c
@@ -458,6 +458,26 @@ int playlistChanges(FILE * fp, mpd_uint32 version) {
return 0;
}
+int playlistChangesPosId(FILE * fp, mpd_uint32 version) {
+ int i;
+
+ for(i=0; i<playlist.length; i++) {
+ if(version > playlist.version ||
+ playlist.songMod[i] >= version ||
+ playlist.songMod[i] == 0)
+ {
+ myfprintf(fp, "cpos: %i\n", i);
+ myfprintf(fp, "Id: %i\n", playlist.positionToId[i]);
+ }
+ }
+
+ return 0;
+}
+
+
+
+
+
int playlistInfo(FILE * fp, int song) {
int i;
int begin = 0;
diff --git a/src/playlist.h b/src/playlist.h
index 589cd5650..0d0c7b9a8 100644
--- a/src/playlist.h
+++ b/src/playlist.h
@@ -114,6 +114,8 @@ void playlistVersionChange();
int playlistChanges(FILE * fp, mpd_uint32 version);
+int playlistChangesPosId(FILE * fp, mpd_uint32 version);
+
int PlaylistInfo(FILE * fp, char * utf8file, int detail);