Add some HTSP support back in.
This commit is contained in:
parent
d65338c072
commit
62daaac5cd
4 changed files with 56 additions and 46 deletions
11
src/epg.c
11
src/epg.c
|
@ -697,8 +697,9 @@ static void _eqr_add_channel
|
|||
}
|
||||
}
|
||||
|
||||
void epg_query(epg_query_result_t *eqr, const char *channel, const char *tag,
|
||||
const char *contentgroup, const char *title)
|
||||
void epg_query0
|
||||
( epg_query_result_t *eqr, channel_t *channel, channel_tag_t *tag,
|
||||
uint8_t contentgroup, const char *title )
|
||||
{
|
||||
// TODO: will need some real code here
|
||||
epg_channel_t *ec;
|
||||
|
@ -712,6 +713,12 @@ void epg_query(epg_query_result_t *eqr, const char *channel, const char *tag,
|
|||
return;
|
||||
}
|
||||
|
||||
void epg_query(epg_query_result_t *eqr, const char *channel, const char *tag,
|
||||
const char *contentgroup, const char *title)
|
||||
{
|
||||
epg_query0(eqr, NULL, NULL, 0, title);
|
||||
}
|
||||
|
||||
void epg_query_free(epg_query_result_t *eqr)
|
||||
{
|
||||
free(eqr->eqr_array);
|
||||
|
|
|
@ -263,12 +263,17 @@ typedef struct epg_query_result {
|
|||
int eqr_alloced;
|
||||
} epg_query_result_t;
|
||||
|
||||
void epg_query_free(epg_query_result_t *eqr);
|
||||
|
||||
/* Sorting */
|
||||
// TODO: comparator function input?
|
||||
void epg_query_sort(epg_query_result_t *eqr);
|
||||
|
||||
/* Query routines */
|
||||
void epg_query0(epg_query_result_t *eqr, channel_t *ch, channel_tag_t *ct,
|
||||
uint8_t type, const char *title);
|
||||
void epg_query(epg_query_result_t *eqr, const char *channel, const char *tag,
|
||||
const char *contentgroup, const char *title);
|
||||
void epg_query_free(epg_query_result_t *eqr);
|
||||
void epg_query_sort(epg_query_result_t *eqr);
|
||||
|
||||
|
||||
/* ************************************************************************
|
||||
|
|
62
src/htsp.c
62
src/htsp.c
|
@ -309,7 +309,7 @@ htsp_build_channel(channel_t *ch, const char *method)
|
|||
if(ch->ch_icon != NULL)
|
||||
htsmsg_add_str(out, "channelIcon", ch->ch_icon);
|
||||
|
||||
#if TODO
|
||||
#if TODO_EPG_CHANNEL
|
||||
htsmsg_add_u32(out, "eventId",
|
||||
ch->ch_epg_current != NULL ? ch->ch_epg_current->e_id : 0);
|
||||
htsmsg_add_u32(out, "nextEventId",
|
||||
|
@ -527,7 +527,7 @@ htsp_method_getTicket(htsp_connection_t *htsp, htsmsg_t *in)
|
|||
static htsmsg_t *
|
||||
htsp_method_addDvrEntry(htsp_connection_t *htsp, htsmsg_t *in)
|
||||
{
|
||||
#if TODO
|
||||
#if TODO_DVR
|
||||
htsmsg_t *out;
|
||||
uint32_t eventid;
|
||||
event_t *e;
|
||||
|
@ -702,7 +702,6 @@ htsp_method_deleteDvrEntry(htsp_connection_t *htsp, htsmsg_t *in)
|
|||
static htsmsg_t *
|
||||
htsp_method_epgQuery(htsp_connection_t *htsp, htsmsg_t *in)
|
||||
{
|
||||
#if TODO
|
||||
htsmsg_t *out, *eventIds;
|
||||
const char *query;
|
||||
int c, i;
|
||||
|
@ -732,7 +731,7 @@ htsp_method_epgQuery(htsp_connection_t *htsp, htsmsg_t *in)
|
|||
if( c ) {
|
||||
eventIds = htsmsg_create_list();
|
||||
for(i = 0; i < c; ++i) {
|
||||
htsmsg_add_u32(eventIds, NULL, eqr.eqr_array[i]->e_id);
|
||||
htsmsg_add_u32(eventIds, NULL, eqr.eqr_array[i]->eb_id);
|
||||
}
|
||||
htsmsg_add_msg(out, "eventIds", eventIds);
|
||||
}
|
||||
|
@ -740,52 +739,58 @@ htsp_method_epgQuery(htsp_connection_t *htsp, htsmsg_t *in)
|
|||
epg_query_free(&eqr);
|
||||
|
||||
return out;
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
#if 0
|
||||
static htsmsg_t *
|
||||
htsp_build_event(event_t *e)
|
||||
htsp_build_event(epg_broadcast_t *e)
|
||||
{
|
||||
htsmsg_t *out;
|
||||
event_t *n;
|
||||
epg_broadcast_t *n;
|
||||
#if TODO_DVR
|
||||
dvr_entry_t *de;
|
||||
#endif
|
||||
|
||||
out = htsmsg_create_map();
|
||||
|
||||
htsmsg_add_u32(out, "eventId", e->e_id);
|
||||
htsmsg_add_u32(out, "eventId", e->eb_id);
|
||||
#if TODO_EPG_CHANNEL
|
||||
htsmsg_add_u32(out, "channelId", e->e_channel->ch_id);
|
||||
htsmsg_add_u32(out, "start", e->e_start);
|
||||
htsmsg_add_u32(out, "stop", e->e_stop);
|
||||
if(e->e_title != NULL)
|
||||
htsmsg_add_str(out, "title", e->e_title);
|
||||
if(e->e_desc != NULL)
|
||||
htsmsg_add_str(out, "description", e->e_desc);
|
||||
#endif
|
||||
htsmsg_add_u32(out, "start", e->eb_start);
|
||||
htsmsg_add_u32(out, "stop", e->eb_stop);
|
||||
if(e->eb_episode->ee_title != NULL)
|
||||
htsmsg_add_str(out, "title", e->eb_episode->ee_title);
|
||||
if(e->eb_episode->ee_description != NULL)
|
||||
htsmsg_add_str(out, "description", e->eb_episode->ee_description);
|
||||
else if(e->eb_episode->ee_summary != NULL)
|
||||
htsmsg_add_str(out, "description", e->eb_episode->ee_summary);
|
||||
#if TODO_REMOVE_THESE
|
||||
if(e->e_ext_desc != NULL)
|
||||
htsmsg_add_str(out, "ext_desc", e->e_ext_desc);
|
||||
if(e->e_ext_item != NULL)
|
||||
htsmsg_add_str(out, "ext_item", e->e_ext_item);
|
||||
if(e->e_ext_text != NULL)
|
||||
htsmsg_add_str(out, "ext_text", e->e_ext_text);
|
||||
#endif
|
||||
|
||||
if(e->e_content_type)
|
||||
htsmsg_add_u32(out, "contentType", e->e_content_type);
|
||||
if(e->eb_episode->ee_genre)
|
||||
htsmsg_add_u32(out, "contentType", e->eb_episode->ee_genre);
|
||||
|
||||
#if TODO_DVR
|
||||
if((de = dvr_entry_find_by_event(e)) != NULL) {
|
||||
htsmsg_add_u32(out, "dvrId", de->de_id);
|
||||
}
|
||||
#endif
|
||||
|
||||
n = RB_NEXT(e, e_channel_link);
|
||||
n = RB_NEXT(e, eb_slink);
|
||||
if(n != NULL)
|
||||
htsmsg_add_u32(out, "nextEventId", n->e_id);
|
||||
htsmsg_add_u32(out, "nextEventId", n->eb_id);
|
||||
|
||||
return out;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Get information about the given event +
|
||||
|
@ -794,10 +799,9 @@ htsp_build_event(event_t *e)
|
|||
static htsmsg_t *
|
||||
htsp_method_getEvents(htsp_connection_t *htsp, htsmsg_t *in)
|
||||
{
|
||||
#if TODO
|
||||
uint32_t eventid, numFollowing;
|
||||
htsmsg_t *out, *events;
|
||||
event_t *e;
|
||||
epg_broadcast_t *e;
|
||||
|
||||
if(htsmsg_get_u32(in, "eventId", &eventid))
|
||||
return htsp_error("Missing argument 'eventId'");
|
||||
|
@ -805,7 +809,7 @@ htsp_method_getEvents(htsp_connection_t *htsp, htsmsg_t *in)
|
|||
if(htsmsg_get_u32(in, "numFollowing", &numFollowing))
|
||||
return htsp_error("Missing argument 'numFollowing'");
|
||||
|
||||
if((e = epg_event_find_by_id(eventid)) == NULL) {
|
||||
if((e = epg_broadcast_find_by_id(eventid)) == NULL) {
|
||||
return htsp_error("Event does not exist");
|
||||
}
|
||||
|
||||
|
@ -814,7 +818,7 @@ htsp_method_getEvents(htsp_connection_t *htsp, htsmsg_t *in)
|
|||
|
||||
htsmsg_add_msg(events, NULL, htsp_build_event(e));
|
||||
while( numFollowing-- > 0 ) {
|
||||
e = RB_NEXT(e, e_channel_link);
|
||||
e = RB_NEXT(e, eb_slink);
|
||||
if( e == NULL )
|
||||
break;
|
||||
htsmsg_add_msg(events, NULL, htsp_build_event(e));
|
||||
|
@ -822,8 +826,6 @@ htsp_method_getEvents(htsp_connection_t *htsp, htsmsg_t *in)
|
|||
|
||||
htsmsg_add_msg(out, "events", events);
|
||||
return out;
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
@ -833,20 +835,18 @@ htsp_method_getEvents(htsp_connection_t *htsp, htsmsg_t *in)
|
|||
static htsmsg_t *
|
||||
htsp_method_getEvent(htsp_connection_t *htsp, htsmsg_t *in)
|
||||
{
|
||||
#if TODO
|
||||
uint32_t eventid;
|
||||
event_t *e;
|
||||
epg_broadcast_t *e;
|
||||
htsmsg_t *out;
|
||||
|
||||
if(htsmsg_get_u32(in, "eventId", &eventid))
|
||||
return htsp_error("Missing argument 'eventId'");
|
||||
|
||||
if((e = epg_event_find_by_id(eventid)) == NULL)
|
||||
if((e = epg_broadcast_find_by_id(eventid)) == NULL)
|
||||
return htsp_error("Event does not exist");
|
||||
|
||||
out = htsp_build_event(e);
|
||||
return out;
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -322,7 +322,7 @@ extjs_channels_update(htsmsg_t *in)
|
|||
if((s = htsmsg_get_str(c, "name")) != NULL)
|
||||
channel_rename(ch, s);
|
||||
|
||||
#if TODO_XMLTV
|
||||
#if TODO_XMLTV_REMOVE_THIS
|
||||
if((s = htsmsg_get_str(c, "xmltvsrc")) != NULL)
|
||||
channel_set_xmltv_source(ch, xmltv_channel_find_by_displayname(s));
|
||||
#endif
|
||||
|
@ -376,7 +376,7 @@ extjs_channels(http_connection_t *hc, const char *remain, void *opaque)
|
|||
htsmsg_add_str(c, "name", ch->ch_name);
|
||||
htsmsg_add_u32(c, "chid", ch->ch_id);
|
||||
|
||||
#if TODO_XMLTV
|
||||
#if TODO_XMLTV_REMOVE_THIS
|
||||
if(ch->ch_xc != NULL)
|
||||
htsmsg_add_str(c, "xmltvsrc", ch->ch_xc->xc_displayname);
|
||||
#endif
|
||||
|
@ -425,7 +425,7 @@ extjs_ecglist(http_connection_t *hc, const char *remain, void *opaque)
|
|||
{
|
||||
htsbuf_queue_t *hq = &hc->hc_reply;
|
||||
htsmsg_t *out, *array;//TODO:, *c;
|
||||
#if TODO
|
||||
#if TODO_GENRE
|
||||
const char *s;
|
||||
int i;
|
||||
#endif
|
||||
|
@ -433,7 +433,7 @@ extjs_ecglist(http_connection_t *hc, const char *remain, void *opaque)
|
|||
out = htsmsg_create_map();
|
||||
array = htsmsg_create_list();
|
||||
|
||||
#if TODO
|
||||
#if TODO_GENRE
|
||||
for(i = 0; i < 16; i++) {
|
||||
if((s = epg_content_group_get_name(i)) == NULL)
|
||||
continue;
|
||||
|
@ -476,7 +476,7 @@ json_single_record(htsmsg_t *rec, const char *root)
|
|||
static int
|
||||
extjs_epggrab(http_connection_t *hc, const char *remain, void *opaque)
|
||||
{
|
||||
#if TODO_EPGGRAB
|
||||
#if TODO_EPGGRAB_CONFIG
|
||||
htsbuf_queue_t *hq = &hc->hc_reply;
|
||||
const char *op = http_arg_get(&hc->hc_req_args, "op");
|
||||
xmltv_channel_t *xc;
|
||||
|
@ -747,9 +747,7 @@ extjs_epg(http_connection_t *hc, const char *remain, void *opaque)
|
|||
htsmsg_add_str(m, "ext_text", e->e_ext_text);
|
||||
#endif
|
||||
|
||||
#if TODO_ARE_WE_JUNKING_THIS
|
||||
htsmsg_add_u32(m, "id", e->e_id);
|
||||
#endif
|
||||
htsmsg_add_u32(m, "id", e->eb_id);
|
||||
htsmsg_add_u32(m, "start", e->eb_start);
|
||||
htsmsg_add_u32(m, "end", e->eb_stop);
|
||||
htsmsg_add_u32(m, "duration", e->eb_stop - e->eb_start);
|
||||
|
@ -807,7 +805,7 @@ extjs_dvr(http_connection_t *hc, const char *remain, void *opaque)
|
|||
|
||||
if(!strcmp(op, "recordEvent")) {
|
||||
|
||||
#if TODO
|
||||
#if TODO_DVR
|
||||
const char *config_name = http_arg_get(&hc->hc_req_args, "config_name");
|
||||
|
||||
s = http_arg_get(&hc->hc_req_args, "eventId");
|
||||
|
@ -921,7 +919,7 @@ extjs_dvr(http_connection_t *hc, const char *remain, void *opaque)
|
|||
htsmsg_add_u32(out, "success", 1);
|
||||
|
||||
} else if(!strcmp(op, "createAutoRec")) {
|
||||
#if TODO
|
||||
#if TODO_DVR
|
||||
const char *cgrp = http_arg_get(&hc->hc_req_args, "contentgrp");
|
||||
|
||||
|
||||
|
@ -1099,7 +1097,7 @@ extjs_dvrlist(http_connection_t *hc, const char *remain, void *opaque)
|
|||
if(de->de_desc != NULL)
|
||||
htsmsg_add_str(m, "description", de->de_desc);
|
||||
|
||||
#if TODO
|
||||
#if TODO_DVR
|
||||
if(de->de_episode.ee_onscreen)
|
||||
htsmsg_add_str(m, "episode", de->de_episode.ee_onscreen);
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue