Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
htsp: add getChannel method, fixes #2283
  • Loading branch information
perexg committed Sep 19, 2014
1 parent ad4de65 commit 19afc9a
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions src/htsp_server.c
Expand Up @@ -71,7 +71,7 @@

static void *htsp_server, *htsp_server_2;

#define HTSP_PROTO_VERSION 13
#define HTSP_PROTO_VERSION 14

#define HTSP_ASYNC_OFF 0x00
#define HTSP_ASYNC_ON 0x01
Expand Down Expand Up @@ -616,7 +616,8 @@ htsp_build_channel(channel_t *ch, const char *method, htsp_connection_t *htsp)

htsmsg_add_msg(out, "services", services);
htsmsg_add_msg(out, "tags", tags);
htsmsg_add_str(out, "method", method);
if (method)
htsmsg_add_str(out, "method", method);
return out;
}

Expand Down Expand Up @@ -1027,6 +1028,23 @@ htsp_method_async(htsp_connection_t *htsp, htsmsg_t *in)
return NULL;
}

/**
* Get information about the given event
*/
static htsmsg_t *
htsp_method_getChannel(htsp_connection_t *htsp, htsmsg_t *in)
{
uint32_t channelId;
channel_t *ch = NULL;

if (htsmsg_get_u32(in, "channelId", &channelId))
return htsp_error("Missing argument 'channelId'");
if (!(ch = channel_find_by_id(channelId)))
return htsp_error("Channel does not exist");

return htsp_build_channel(ch, NULL, htsp);
}

/**
* Get information about the given event
*/
Expand Down Expand Up @@ -2094,6 +2112,7 @@ struct {
{ "getDiskSpace", htsp_method_getDiskSpace, ACCESS_STREAMING},
{ "getSysTime", htsp_method_getSysTime, ACCESS_STREAMING},
{ "enableAsyncMetadata", htsp_method_async, ACCESS_STREAMING},
{ "getChannel", htsp_method_getChannel, ACCESS_STREAMING},
{ "getEvent", htsp_method_getEvent, ACCESS_STREAMING},
{ "getEvents", htsp_method_getEvents, ACCESS_STREAMING},
{ "epgQuery", htsp_method_epgQuery, ACCESS_STREAMING},
Expand Down

0 comments on commit 19afc9a

Please sign in to comment.