mirror of
https://github.com/owntone/owntone-server.git
synced 2025-02-05 02:38:09 -05:00
[mpd] correct handling of noidle
command
This commit is contained in:
parent
8d130cdc7c
commit
fa76b6380c
42
src/mpd.c
42
src/mpd.c
@ -632,6 +632,7 @@ mpd_command_currentsong(struct evbuffer *evbuf, int argc, char **argv, char **er
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
mpd_notify_idle_client(struct mpd_client_ctx *client_ctx, short events);
|
mpd_notify_idle_client(struct mpd_client_ctx *client_ctx, short events);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Example input:
|
* Example input:
|
||||||
* idle "database" "mixer" "options" "output" "player" "playlist" "sticker" "update"
|
* idle "database" "mixer" "options" "output" "player" "playlist" "sticker" "update"
|
||||||
@ -679,41 +680,16 @@ mpd_command_idle(struct evbuffer *evbuf, int argc, char **argv, char **errmsg, s
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//static void
|
|
||||||
//mpd_remove_client(struct evbuffer *evbuf)
|
|
||||||
//{
|
|
||||||
// struct idle_client *client;
|
|
||||||
// struct idle_client *prev;
|
|
||||||
//
|
|
||||||
// client = idle_clients;
|
|
||||||
// prev = NULL;
|
|
||||||
//
|
|
||||||
// while (client)
|
|
||||||
// {
|
|
||||||
// if (client->evbuffer == evbuf)
|
|
||||||
// {
|
|
||||||
// DPRINTF(E_DBG, L_MPD, "Removing idle client for evbuffer\n");
|
|
||||||
//
|
|
||||||
// if (prev)
|
|
||||||
// prev->next = client->next;
|
|
||||||
// else
|
|
||||||
// idle_clients = client->next;
|
|
||||||
//
|
|
||||||
// free(client);
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// prev = client;
|
|
||||||
// client = client->next;
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
mpd_command_noidle(struct evbuffer *evbuf, int argc, char **argv, char **errmsg, struct mpd_client_ctx *ctx)
|
mpd_command_noidle(struct evbuffer *evbuf, int argc, char **argv, char **errmsg, struct mpd_client_ctx *ctx)
|
||||||
{
|
{
|
||||||
ctx->is_idle = false;
|
/*
|
||||||
ctx->idle_events = 0;
|
* The protocol specifies: "The idle command can be canceled by
|
||||||
return 0;
|
* sending the command noidle (no other commands are allowed). MPD
|
||||||
|
* will then leave idle mode and print results immediately; might be
|
||||||
|
* empty at this time."
|
||||||
|
*/
|
||||||
|
return mpd_notify_idle_client(ctx, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -859,7 +835,7 @@ mpd_command_stats(struct evbuffer *evbuf, int argc, char **argv, char **errmsg,
|
|||||||
"songs: %d\n"
|
"songs: %d\n"
|
||||||
"uptime: %d\n" //in seceonds
|
"uptime: %d\n" //in seceonds
|
||||||
"db_playtime: %" PRIi64 "\n"
|
"db_playtime: %" PRIi64 "\n"
|
||||||
"db_update: %ld\n"
|
"db_update: %" PRIi64 "\n"
|
||||||
"playtime: %d\n",
|
"playtime: %d\n",
|
||||||
artists,
|
artists,
|
||||||
albums,
|
albums,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user