have pause take an optional arugment
git-svn-id: https://svn.musicpd.org/mpd/trunk@43 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
parent
068d307a71
commit
aaf4282654
|
@ -144,6 +144,16 @@ int handleStop(FILE * fp, unsigned int * permission, int argArrayLength,
|
||||||
int handlePause(FILE * fp, unsigned int * permission,
|
int handlePause(FILE * fp, unsigned int * permission,
|
||||||
int argArrayLength, char ** argArray)
|
int argArrayLength, char ** argArray)
|
||||||
{
|
{
|
||||||
|
if(argArrayLength==2) {
|
||||||
|
char * test;
|
||||||
|
int pause = strtol(argArray[1],&test,10);
|
||||||
|
if(*test!='\0' || (pause!=0 && pause!=1)) {
|
||||||
|
myfprintf(fp,"%s \%s\" is not 0 or 1\n",
|
||||||
|
COMMAND_RESPOND_ERROR,pause);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return playerSetPause(fp,pause);
|
||||||
|
}
|
||||||
return playerPause(fp);
|
return playerPause(fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -524,7 +534,7 @@ void initCommands() {
|
||||||
|
|
||||||
addCommand(COMMAND_PLAY ,PERMISSION_CONTROL, 0, 1,handlePlay);
|
addCommand(COMMAND_PLAY ,PERMISSION_CONTROL, 0, 1,handlePlay);
|
||||||
addCommand(COMMAND_STOP ,PERMISSION_CONTROL, 0, 0,handleStop);
|
addCommand(COMMAND_STOP ,PERMISSION_CONTROL, 0, 0,handleStop);
|
||||||
addCommand(COMMAND_PAUSE ,PERMISSION_CONTROL, 0, 0,handlePause);
|
addCommand(COMMAND_PAUSE ,PERMISSION_CONTROL, 0, 1,handlePause);
|
||||||
addCommand(COMMAND_STATUS ,PERMISSION_READ, 0, 0,commandStatus);
|
addCommand(COMMAND_STATUS ,PERMISSION_READ, 0, 0,commandStatus);
|
||||||
addCommand(COMMAND_KILL ,PERMISSION_ADMIN, -1,-1,handleKill);
|
addCommand(COMMAND_KILL ,PERMISSION_ADMIN, -1,-1,handleKill);
|
||||||
addCommand(COMMAND_CLOSE ,0, -1,-1,handleClose);
|
addCommand(COMMAND_CLOSE ,0, -1,-1,handleClose);
|
||||||
|
|
17
src/player.c
17
src/player.c
|
@ -215,6 +215,23 @@ int playerPause(FILE * fp) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int playerSetPause(FILE * fp, int pause) {
|
||||||
|
PlayerControl * pc = &(getPlayerData()->playerControl);
|
||||||
|
|
||||||
|
if(player_pid<=0) return 0;
|
||||||
|
|
||||||
|
switch(pc->state) {
|
||||||
|
case PLAYER_STATE_PLAY:
|
||||||
|
if(pause) playerPause(fp);
|
||||||
|
break;
|
||||||
|
case PLAYER_STATE_PAUSE:
|
||||||
|
if(!pause) playerPause(fp);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int getPlayerElapsedTime() {
|
int getPlayerElapsedTime() {
|
||||||
return (int)(getPlayerData()->playerControl.elapsedTime+0.5);
|
return (int)(getPlayerData()->playerControl.elapsedTime+0.5);
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,6 +75,8 @@ void player_sigHandler(int signal);
|
||||||
|
|
||||||
int playerPlay(FILE * fp, char * utf8file);
|
int playerPlay(FILE * fp, char * utf8file);
|
||||||
|
|
||||||
|
int playerSetPause(FILE * fp, int pause);
|
||||||
|
|
||||||
int playerPause(FILE * fp);
|
int playerPause(FILE * fp);
|
||||||
|
|
||||||
int playerStop(FILE * fp);
|
int playerStop(FILE * fp);
|
||||||
|
|
Loading…
Reference in New Issue