new commands: enalbe_device, and disable_device, (maybe these commands should be toggles instead of two seperate commands?)
also, on close device, close the shout connection git-svn-id: https://svn.musicpd.org/mpd/trunk@2485 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
parent
69176148bf
commit
44eb26c16f
3
TODO
3
TODO
|
@ -30,6 +30,9 @@
|
|||
|
||||
*) have children ignore SIGHUP
|
||||
|
||||
*) put more debugging info when failing to read/write db and other similar
|
||||
errors
|
||||
|
||||
Post-1.0
|
||||
--------
|
||||
*) crosslink "list" stuff, for example, artists are crosslinked to alubms and
|
||||
|
|
|
@ -65,4 +65,10 @@ int isCurrentAudioFormat(AudioFormat * audioFormat);
|
|||
|
||||
void sendMetadataToAudioDevice(MpdTag * tag);
|
||||
|
||||
/* these functions are called in the main parent process while the child
|
||||
process is busy playing to the audio */
|
||||
int enableAudioDevice(FILE * fp, int device);
|
||||
|
||||
int disableAudioDevice(FILE * fp, int device);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -289,6 +289,10 @@ static void myShout_finishDriver(AudioOutput * audioOutput) {
|
|||
}
|
||||
|
||||
static void myShout_closeDevice(AudioOutput * audioOutput) {
|
||||
ShoutData * sd = (ShoutData *)audioOutput->data;
|
||||
|
||||
myShout_closeShoutConn(sd);
|
||||
|
||||
audioOutput->open = 0;
|
||||
}
|
||||
|
||||
|
@ -376,7 +380,9 @@ static int myShout_openShoutConn(AudioOutput * audioOutput) {
|
|||
ShoutData * sd = (ShoutData *)audioOutput->data;
|
||||
time_t t = time(NULL);
|
||||
|
||||
if(t - sd->lastAttempt < CONN_ATTEMPT_INTERVAL) {
|
||||
if(sd->connAttempts!= 0 &&
|
||||
(t - sd->lastAttempt) < CONN_ATTEMPT_INTERVAL)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -82,6 +82,8 @@
|
|||
#define COMMAND_URL_HANDLERS "urlhandlers"
|
||||
#define COMMAND_PLCHANGES "plchanges"
|
||||
#define COMMAND_CURRENTSONG "currentsong"
|
||||
#define COMMAND_ENABLE_DEV "enable_device"
|
||||
#define COMMAND_DISABLE_DEV "disable_device"
|
||||
|
||||
#define COMMAND_STATUS_VOLUME "volume"
|
||||
#define COMMAND_STATUS_STATE "state"
|
||||
|
@ -756,6 +758,38 @@ int handleCrossfade(FILE * fp, unsigned int * permission, int argArrayLength,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int handleEnableDevice(FILE * fp, unsigned int * permission, int argArrayLength,
|
||||
char ** argArray)
|
||||
{
|
||||
int device;
|
||||
char * test;
|
||||
|
||||
device = strtol(argArray[1],&test,10);
|
||||
if(*test!='\0' || device<0) {
|
||||
commandError(fp, ACK_ERROR_ARG,
|
||||
"\"%s\" is not a integer >= 0", argArray[1]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return enableAudioDevice(fp, device);
|
||||
}
|
||||
|
||||
int handleDisableDevice(FILE * fp, unsigned int * permission,
|
||||
int argArrayLength, char ** argArray)
|
||||
{
|
||||
int device;
|
||||
char * test;
|
||||
|
||||
device = strtol(argArray[1],&test,10);
|
||||
if(*test!='\0' || device<0) {
|
||||
commandError(fp, ACK_ERROR_ARG,
|
||||
"\"%s\" is not a integer >= 0", argArray[1]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return disableAudioDevice(fp, device);
|
||||
}
|
||||
|
||||
void initCommands() {
|
||||
commandList = makeList(free);
|
||||
|
||||
|
@ -804,6 +838,8 @@ 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_ENABLE_DEV ,PERMISSION_ADMIN, 1, 1,handleEnableDevice,NULL);
|
||||
addCommand(COMMAND_DISABLE_DEV ,PERMISSION_ADMIN, 1, 1,handleDisableDevice,NULL);
|
||||
|
||||
sortList(commandList);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue