From 1e21969095709063e20a984ee0a81d664d60bc53 Mon Sep 17 00:00:00 2001 From: Adam Sutton Date: Fri, 18 May 2012 17:32:17 +0100 Subject: [PATCH] Clear some more redundant code from the channel structure. --- src/channels.c | 16 +++++++++++----- src/channels.h | 2 +- src/dvr/dvr_autorec.c | 2 ++ src/htsp.c | 11 +++++------ src/webui/webui.c | 12 +++++++----- 5 files changed, 26 insertions(+), 17 deletions(-) diff --git a/src/channels.c b/src/channels.c index 8148f5c4..8301338c 100644 --- a/src/channels.c +++ b/src/channels.c @@ -175,8 +175,12 @@ channel_create(const char *name, int number) } ch = calloc(1, sizeof(channel_t)); +#if TODO_EPG_CHANNEL RB_INIT(&ch->ch_epg_events); - //LIST_INSERT_HEAD(&channels_not_xmltv_mapped, ch, ch_xc_link); +#endif +#if TODO_XMLTV + LIST_INSERT_HEAD(&channels_not_xmltv_mapped, ch, ch_xc_link); +#endif channel_set_name(ch, name); ch->ch_number = number; @@ -186,7 +190,7 @@ channel_create(const char *name, int number) assert(x == NULL); -#if 0 +#if TODO_XMLTV if((xc = xmltv_channel_find_by_displayname(name)) != NULL) { channel_set_xmltv_source(ch, xc); if(xc->xc_icon != NULL) @@ -258,11 +262,13 @@ channel_load_one(htsmsg_t *c, int id) return; } +#if TODO_EPG_CHANNEL RB_INIT(&ch->ch_epg_events); +#endif channel_set_name(ch, name); -#if 0 +#if TODO_XMLTV if((s = htsmsg_get_str(c, "xmltv-channel")) != NULL && (ch->ch_xc = xmltv_channel_find(s, 0)) != NULL) { LIST_INSERT_HEAD(&ch->ch_xc->xc_channels, ch, ch_xc_link); @@ -326,7 +332,7 @@ channel_save(channel_t *ch) htsmsg_add_str(m, "name", ch->ch_name); -#if 0 +#if TODO_XMLTV if(ch->ch_xc != NULL) htsmsg_add_str(m, "xmltv-channel", ch->ch_xc->xc_identifier); #endif @@ -511,7 +517,7 @@ channel_set_number(channel_t *ch, int number) /** * */ -#if 0 +#if TODO_XMLTV void channel_set_xmltv_source(channel_t *ch, xmltv_channel_t *xc) { diff --git a/src/channels.h b/src/channels.h index dfe1b332..c59572c6 100644 --- a/src/channels.h +++ b/src/channels.h @@ -44,7 +44,7 @@ typedef struct channel { LIST_HEAD(, th_subscription) ch_subscriptions; struct epg_channel *ch_epg_channel; -#if 1 //TODO_REMOVE_THESE +#if TODO_EPG_CHANNEL struct event_tree ch_epg_events; struct event *ch_epg_current; struct event *ch_epg_next; diff --git a/src/dvr/dvr_autorec.c b/src/dvr/dvr_autorec.c index 3269d996..19d76576 100644 --- a/src/dvr/dvr_autorec.c +++ b/src/dvr/dvr_autorec.c @@ -511,6 +511,7 @@ dvr_autorec_check_event(event_t *e) static void dvr_autorec_changed(dvr_autorec_entry_t *dae) { +#if TODO_DVR channel_t *ch; event_t *e; @@ -522,6 +523,7 @@ dvr_autorec_changed(dvr_autorec_entry_t *dae) dvr_entry_create_by_autorec(e, dae); } } +#endif } diff --git a/src/htsp.c b/src/htsp.c index 9c0fdef0..3fee181b 100644 --- a/src/htsp.c +++ b/src/htsp.c @@ -1418,18 +1418,17 @@ htsp_async_send(htsmsg_t *m) void htsp_channel_update_current(channel_t *ch) { + epg_broadcast_t *now, *next; htsmsg_t *m; - time_t now; - time(&now); m = htsmsg_create_map(); htsmsg_add_str(m, "method", "channelUpdate"); htsmsg_add_u32(m, "channelId", ch->ch_id); - htsmsg_add_u32(m, "eventId", - ch->ch_epg_current ? ch->ch_epg_current->e_id : 0); - htsmsg_add_u32(m, "nextEventId", - ch->ch_epg_next ? ch->ch_epg_next->e_id : 0); + now = epg_channel_get_current_broadcast(ch->ch_epg_channel); + next = epg_broadcast_get_next(now); + htsmsg_add_u32(m, "eventId", now ? now->eb_id : 0); + htsmsg_add_u32(m, "nextEventId", next ? next->eb_id : 0); htsp_async_send(m); } diff --git a/src/webui/webui.c b/src/webui/webui.c index 929341eb..130da94d 100644 --- a/src/webui/webui.c +++ b/src/webui/webui.c @@ -39,6 +39,7 @@ #include "psi.h" #include "plumbing/tsfix.h" #include "plumbing/globalheaders.h" +#include "epg.h" struct filebundle *filebundles; @@ -179,13 +180,14 @@ http_stream_run(http_connection_t *hc, streaming_queue_t *sq, th_subscription_t run = !mk_mux_write_pkt(mkm, sm->sm_data); sm->sm_data = NULL; - event_t *e = NULL; - if(s->ths_channel) - e = s->ths_channel->ch_epg_current; + epg_broadcast_t *e = NULL; + if(s->ths_channel) e = epg_channel_get_current_broadcast(s->ths_channel->ch_epg_channel); - if(e && event_id != e->e_id) { - event_id = e->e_id; + if(e && event_id != e->eb_id) { + event_id = e->eb_id; +#if TODO_EVENT run = !mk_mux_append_meta(mkm, e); +#endif } break; }