Commit c77011bf authored by Warren Dukes's avatar Warren Dukes

update job id stuff

git-svn-id: https://svn.musicpd.org/mpd/trunk@673 09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent 4cfd77be
...@@ -165,6 +165,7 @@ int commandStatus(FILE * fp, unsigned int * permission, int argArrayLength, ...@@ -165,6 +165,7 @@ int commandStatus(FILE * fp, unsigned int * permission, int argArrayLength,
char ** argArray) char ** argArray)
{ {
char * state = NULL; char * state = NULL;
int updateJobId;
playPlaylistIfPlayerStopped(); playPlaylistIfPlayerStopped();
switch(getPlayerState()) { switch(getPlayerState()) {
...@@ -194,7 +195,9 @@ int commandStatus(FILE * fp, unsigned int * permission, int argArrayLength, ...@@ -194,7 +195,9 @@ int commandStatus(FILE * fp, unsigned int * permission, int argArrayLength,
myfprintf(fp,"%s: %u:%i:%i\n",COMMAND_STATUS_AUDIO,getPlayerSampleRate(),getPlayerBits(),getPlayerChannels()); myfprintf(fp,"%s: %u:%i:%i\n",COMMAND_STATUS_AUDIO,getPlayerSampleRate(),getPlayerBits(),getPlayerChannels());
} }
if(isUpdatingDB()) myfprintf(fp,"%s: 1\n",COMMAND_STATUS_UPDATING_DB); if((updateJobId = isUpdatingDB())) {
myfprintf(fp,"%s: %i\n",COMMAND_STATUS_UPDATING_DB,updateJobId);
}
if(getPlayerError()!=PLAYER_ERROR_NOERROR) { if(getPlayerError()!=PLAYER_ERROR_NOERROR) {
myfprintf(fp,"%s: %s\n",COMMAND_STATUS_ERROR,getPlayerErrorStr()); myfprintf(fp,"%s: %s\n",COMMAND_STATUS_ERROR,getPlayerErrorStr());
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "listen.h" #include "listen.h"
#include "interface.h" #include "interface.h"
#include "volume.h" #include "volume.h"
#include "mpd_types.h"
#include <string.h> #include <string.h>
#include <sys/types.h> #include <sys/types.h>
...@@ -72,6 +73,8 @@ char directorydb[MAXPATHLEN+1]; ...@@ -72,6 +73,8 @@ char directorydb[MAXPATHLEN+1];
int directory_updatePid = 0; int directory_updatePid = 0;
mpd_uint16 directory_updateJobId = 0;
DirectoryList * newDirectoryList(); DirectoryList * newDirectoryList();
int addToDirectory(Directory * directory, char * shortname, char * name); int addToDirectory(Directory * directory, char * shortname, char * name);
...@@ -89,7 +92,7 @@ void deleteEmptyDirectoriesInDirectory(Directory * directory); ...@@ -89,7 +92,7 @@ void deleteEmptyDirectoriesInDirectory(Directory * directory);
int addSubDirectoryToDirectory(Directory * directory, char * shortname, char * name); int addSubDirectoryToDirectory(Directory * directory, char * shortname, char * name);
int isUpdatingDB() { int isUpdatingDB() {
if(directory_updatePid>0) return 1; if(directory_updatePid>0) return directory_updateJobId;
return 0; return 0;
} }
...@@ -143,7 +146,11 @@ int updateInit(FILE * fp) { ...@@ -143,7 +146,11 @@ int updateInit(FILE * fp) {
return -1; return -1;
} }
DEBUG("updateInit: fork()'d update child\n"); directory_updateJobId++;
if(directory_updateJobId > 1<<15) directory_updateJobId = 1;
DEBUG("updateInit: fork()'d update child for update job id %i\n",
(int)directory_updateJobId);
myfprintf(fp,"updating_db: %i\n",(int)directory_updateJobId);
return 0; return 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment