mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-28 08:05:56 -05:00
[ws] Notify about player status, options, volume, queue changes
This commit is contained in:
parent
5cb33189df
commit
4ebc6da0ee
@ -145,6 +145,22 @@ process_notify_request(struct ws_session_data_notify *session_data, void *in, si
|
|||||||
{
|
{
|
||||||
session_data->events |= LISTENER_SPEAKER;
|
session_data->events |= LISTENER_SPEAKER;
|
||||||
}
|
}
|
||||||
|
else if (0 == strcmp(event_type, "player"))
|
||||||
|
{
|
||||||
|
session_data->events |= LISTENER_PLAYER;
|
||||||
|
}
|
||||||
|
else if (0 == strcmp(event_type, "options"))
|
||||||
|
{
|
||||||
|
session_data->events |= LISTENER_OPTIONS;
|
||||||
|
}
|
||||||
|
else if (0 == strcmp(event_type, "volume"))
|
||||||
|
{
|
||||||
|
session_data->events |= LISTENER_VOLUME;
|
||||||
|
}
|
||||||
|
else if (0 == strcmp(event_type, "queue"))
|
||||||
|
{
|
||||||
|
session_data->events |= LISTENER_QUEUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -193,6 +209,22 @@ send_notify_reply(short events, struct lws* wsi)
|
|||||||
{
|
{
|
||||||
json_object_array_add(notify, json_object_new_string("outputs"));
|
json_object_array_add(notify, json_object_new_string("outputs"));
|
||||||
}
|
}
|
||||||
|
if (events & LISTENER_PLAYER)
|
||||||
|
{
|
||||||
|
json_object_array_add(notify, json_object_new_string("player"));
|
||||||
|
}
|
||||||
|
if (events & LISTENER_OPTIONS)
|
||||||
|
{
|
||||||
|
json_object_array_add(notify, json_object_new_string("options"));
|
||||||
|
}
|
||||||
|
if (events & LISTENER_VOLUME)
|
||||||
|
{
|
||||||
|
json_object_array_add(notify, json_object_new_string("volume"));
|
||||||
|
}
|
||||||
|
if (events & LISTENER_QUEUE)
|
||||||
|
{
|
||||||
|
json_object_array_add(notify, json_object_new_string("queue"));
|
||||||
|
}
|
||||||
|
|
||||||
reply = json_object_new_object();
|
reply = json_object_new_object();
|
||||||
json_object_object_add(reply, "notify", notify);
|
json_object_object_add(reply, "notify", notify);
|
||||||
@ -274,7 +306,8 @@ static struct lws_protocols protocols[] =
|
|||||||
static void *
|
static void *
|
||||||
websocket(void *arg)
|
websocket(void *arg)
|
||||||
{
|
{
|
||||||
listener_add(listener_cb, LISTENER_UPDATE | LISTENER_PAIRING | LISTENER_SPOTIFY | LISTENER_LASTFM | LISTENER_SPEAKER);
|
listener_add(listener_cb, LISTENER_UPDATE | LISTENER_PAIRING | LISTENER_SPOTIFY | LISTENER_LASTFM | LISTENER_SPEAKER
|
||||||
|
| LISTENER_PLAYER | LISTENER_OPTIONS | LISTENER_VOLUME | LISTENER_QUEUE);
|
||||||
|
|
||||||
while(!ws_exit)
|
while(!ws_exit)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user