Fix some of the advanced remote code
This commit is contained in:
@@ -177,7 +177,7 @@ int dacp_send_command(const char *command, char **body, ssize_t *bodysize) {
|
||||
response.code = 497; // Can't establish a socket to the DACP server
|
||||
} else {
|
||||
struct timeval tv;
|
||||
tv.tv_sec = 1;
|
||||
tv.tv_sec = 2;
|
||||
tv.tv_usec = 0;
|
||||
if (setsockopt(sockfd, SOL_SOCKET, SO_RCVTIMEO, (const char *)&tv, sizeof tv) == -1)
|
||||
debug(1, "Error %d setting receive timeout for DACP service.", errno);
|
||||
@@ -187,7 +187,7 @@ int dacp_send_command(const char *command, char **body, ssize_t *bodysize) {
|
||||
// connect!
|
||||
// debug(1, "DACP socket created.");
|
||||
if (connect(sockfd, res->ai_addr, res->ai_addrlen) < 0) {
|
||||
// debug(1, "DACP connect failed.");
|
||||
debug(3, "DACP connect failed with errno %d.",errno);
|
||||
response.code = 496; // Can't connect to the DACP server
|
||||
} else {
|
||||
// debug(1,"DACP connect succeeded.");
|
||||
@@ -367,6 +367,7 @@ void *dacp_monitor_thread_code(__attribute__((unused)) void *na) {
|
||||
int32_t revision_number = 1;
|
||||
while (1) {
|
||||
int result;
|
||||
int changed = 0;
|
||||
sps_pthread_mutex_timedlock(
|
||||
&dacp_server_information_lock, 500000,
|
||||
"dacp_monitor_thread_code couldn't get DACP server information lock in 0.5 second!.", 1);
|
||||
@@ -459,23 +460,20 @@ void *dacp_monitor_thread_code(__attribute__((unused)) void *na) {
|
||||
case 2:
|
||||
if (metadata_store.play_status != PS_STOPPED) {
|
||||
metadata_store.play_status = PS_STOPPED;
|
||||
metadata_store.play_status_changed = 1;
|
||||
debug(1, "Play status changed to \"stopped\".");
|
||||
debug(1, "Play status is \"stopped\".");
|
||||
metadata_store.changed = 1;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (metadata_store.play_status != PS_PAUSED) {
|
||||
metadata_store.play_status = PS_PAUSED;
|
||||
metadata_store.play_status_changed = 1;
|
||||
debug(1, "Play status changed to \"paused\".");
|
||||
debug(1, "Play status is \"paused\".");
|
||||
metadata_store.changed = 1;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
if (metadata_store.play_status != PS_PLAYING) {
|
||||
metadata_store.play_status = PS_PLAYING;
|
||||
metadata_store.play_status_changed = 1;
|
||||
debug(1, "Play status changed to \"playing\".");
|
||||
metadata_store.changed = 1;
|
||||
}
|
||||
@@ -492,16 +490,14 @@ void *dacp_monitor_thread_code(__attribute__((unused)) void *na) {
|
||||
case 0:
|
||||
if (metadata_store.shuffle_status != SS_OFF) {
|
||||
metadata_store.shuffle_status = SS_OFF;
|
||||
metadata_store.shuffle_status_changed = 1;
|
||||
debug(1, "Shuffle status changed to \"off\".");
|
||||
debug(1, "Shuffle status is \"off\".");
|
||||
metadata_store.changed = 1;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (metadata_store.shuffle_status != SS_ON) {
|
||||
metadata_store.shuffle_status = SS_ON;
|
||||
metadata_store.shuffle_status_changed = 1;
|
||||
debug(1, "Shuffle status changed to \"on\".");
|
||||
debug(1, "Shuffle status is \"on\".");
|
||||
metadata_store.changed = 1;
|
||||
}
|
||||
break;
|
||||
@@ -517,24 +513,21 @@ void *dacp_monitor_thread_code(__attribute__((unused)) void *na) {
|
||||
case 0:
|
||||
if (metadata_store.repeat_status != RS_OFF) {
|
||||
metadata_store.repeat_status = RS_OFF;
|
||||
metadata_store.repeat_status_changed = 1;
|
||||
debug(1, "Repeat status changed to \"none\".");
|
||||
debug(1, "Repeat status is \"none\".");
|
||||
metadata_store.changed = 1;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (metadata_store.repeat_status != RS_ONE) {
|
||||
metadata_store.repeat_status = RS_ONE;
|
||||
metadata_store.repeat_status_changed = 1;
|
||||
debug(1, "Repeat status changed to \"one\".");
|
||||
debug(1, "Repeat status is \"one\".");
|
||||
metadata_store.changed = 1;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (metadata_store.repeat_status != RS_ALL) {
|
||||
metadata_store.repeat_status = RS_ALL;
|
||||
metadata_store.repeat_status_changed = 1;
|
||||
debug(1, "Repeat status changed to \"all\".");
|
||||
debug(1, "Repeat status is \"all\".");
|
||||
metadata_store.changed = 1;
|
||||
}
|
||||
break;
|
||||
@@ -618,6 +611,7 @@ void *dacp_monitor_thread_code(__attribute__((unused)) void *na) {
|
||||
t = sp - item_size;
|
||||
r = ntohl(*(uint32_t *)(t));
|
||||
metadata_store.songtime_in_milliseconds = ntohl(*(uint32_t *)(t));
|
||||
metadata_store.changed = 1;
|
||||
break;
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user