From: Jaroslav Kysela Date: Thu, 29 Oct 2015 07:29:58 +0000 (+0100) Subject: Revert "channel: add possibility to reuse EPG from another channel, fixes #3217" X-Git-Tag: v4.2.1~1746 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=eb13bbf979d672ef5020b902852581069ddb8fbc;p=thirdparty%2Ftvheadend.git Revert "channel: add possibility to reuse EPG from another channel, fixes #3217" This reverts commit 3ba8ec1989972c56f0fbb71f3b6061d50a0be740. It does not work as expected. The EPG data must be duplicated in database. --- diff --git a/src/channels.c b/src/channels.c index 9bab7e121..b1301f71a 100644 --- a/src/channels.c +++ b/src/channels.c @@ -397,14 +397,6 @@ const idclass_t channel_class = { .list = bouquet_class_get_list, .opts = PO_RDONLY }, - { - .type = PT_STR, - .id = "epg_parent", - .name = N_("Reuse EPG from"), - .list = channel_class_get_list, - .off = offsetof(channel_t, ch_epg_parent), - .opts = PO_ADVANCED - }, {} } }; @@ -790,18 +782,6 @@ channel_create0 return ch; } -static void -channel_epg_parent_unlink ( channel_t *ch ) -{ - char uuid[UUID_HEX_SIZE]; - idnode_uuid_as_str(&ch->ch_id, uuid); - RB_FOREACH(ch, &channels, ch_link) - if (ch->ch_epg_parent && !strcmp(ch->ch_epg_parent, uuid)) { - free(ch->ch_epg_parent); - ch->ch_epg_parent = NULL; - } -} - void channel_delete ( channel_t *ch, int delconf ) { @@ -835,7 +815,6 @@ channel_delete ( channel_t *ch, int delconf ) /* EPG */ epggrab_channel_rem(ch); epg_channel_unlink(ch); - channel_epg_parent_unlink(ch); /* HTSP */ htsp_channel_delete(ch); @@ -847,7 +826,6 @@ channel_delete ( channel_t *ch, int delconf ) /* Free memory */ RB_REMOVE(&channels, ch, ch_link); idnode_unlink(&ch->ch_id); - free(ch->ch_epg_parent); free(ch->ch_name); free(ch->ch_icon); free(ch); diff --git a/src/channels.h b/src/channels.h index 51ec77b58..7a8c75508 100644 --- a/src/channels.h +++ b/src/channels.h @@ -61,7 +61,6 @@ typedef struct channel LIST_HEAD(, th_subscription) ch_subscriptions; /* EPG fields */ - char *ch_epg_parent; epg_broadcast_tree_t ch_epg_schedule; epg_broadcast_t *ch_epg_now; epg_broadcast_t *ch_epg_next; @@ -69,7 +68,7 @@ typedef struct channel gtimer_t ch_epg_timer_head; gtimer_t ch_epg_timer_current; - int ch_epgauto; + int ch_epgauto; idnode_list_head_t ch_epggrab; /* 1 = epggrab channel, 2 = channel */ /* DVR */ @@ -182,20 +181,4 @@ const char *channel_get_epgid ( channel_t *ch ); #define channel_get_id(ch) idnode_get_short_uuid((&(ch)->ch_id)) -static inline channel_t *channel_epg_parent(channel_t *ch) -{ - if (ch->ch_epg_parent != NULL) - return channel_find_by_uuid(ch->ch_epg_parent); - return NULL; -} - -static inline epg_broadcast_tree_t *channel_epg_schedule(channel_t *ch) -{ - if (ch->ch_epg_parent != NULL) { - channel_t *ch2 = channel_find_by_uuid(ch->ch_epg_parent); - if (ch2) return &ch2->ch_epg_schedule; - } - return &ch->ch_epg_schedule; -} - #endif /* CHANNELS_H */ diff --git a/src/dvr/dvr_autorec.c b/src/dvr/dvr_autorec.c index 130ac9a93..9be718798 100644 --- a/src/dvr/dvr_autorec.c +++ b/src/dvr/dvr_autorec.c @@ -1266,7 +1266,7 @@ dvr_autorec_changed(dvr_autorec_entry_t *dae, int purge) CHANNEL_FOREACH(ch) { if (!ch->ch_enabled) continue; - RB_FOREACH(e, channel_epg_schedule(ch), sched_link) { + RB_FOREACH(e, &ch->ch_epg_schedule, sched_link) { if(autorec_cmp(dae, e)) { enabled = 1; if (disabled) { diff --git a/src/dvr/dvr_db.c b/src/dvr/dvr_db.c index a4f170848..fc18735bc 100644 --- a/src/dvr/dvr_db.c +++ b/src/dvr/dvr_db.c @@ -942,7 +942,7 @@ not_so_good: e = NULL; pre = (60 * dvr_entry_get_extra_time_pre(de)) - 30; - RB_FOREACH(ev, channel_epg_schedule(de->de_channel), sched_link) { + RB_FOREACH(ev, &de->de_channel->ch_epg_schedule, sched_link) { if (de->de_bcast == ev) continue; if (ev->start - pre < dispatch_clock) continue; if (dvr_entry_fuzzy_match(de, ev, 0, INT64_MAX)) @@ -1472,7 +1472,7 @@ dvr_event_replaced(epg_broadcast_t *e, epg_broadcast_t *new_e) /* Find match */ } else { - RB_FOREACH(e, channel_epg_schedule(e->channel), sched_link) { + RB_FOREACH(e, &e->channel->ch_epg_schedule, sched_link) { if (dvr_entry_fuzzy_match(de, e, e->dvb_eid, de->de_config->dvr_update_window)) { tvhtrace("dvr", diff --git a/src/epg.c b/src/epg.c index 01b6b35d4..aae95c023 100644 --- a/src/epg.c +++ b/src/epg.c @@ -2389,7 +2389,7 @@ static void _eq_add_channel ( epg_query_t *eq, channel_t *ch ) { epg_broadcast_t *ebc; - RB_FOREACH(ebc, channel_epg_schedule(ch), sched_link) { + RB_FOREACH(ebc, &ch->ch_epg_schedule, sched_link) { if (ebc->episode) _eq_add(eq, ebc); } diff --git a/src/htsp_server.c b/src/htsp_server.c index 17e9f6346..52bcf8446 100644 --- a/src/htsp_server.c +++ b/src/htsp_server.c @@ -587,7 +587,6 @@ static htsmsg_t * htsp_build_channel(channel_t *ch, const char *method, htsp_connection_t *htsp) { idnode_list_mapping_t *ilm; - channel_t *src = channel_epg_parent(ch) ?: ch; channel_tag_t *ct; service_t *t; epg_broadcast_t *now, *next = NULL; @@ -636,8 +635,8 @@ htsp_build_channel(channel_t *ch, const char *method, htsp_connection_t *htsp) } } - now = src->ch_epg_now; - next = src->ch_epg_next; + now = ch->ch_epg_now; + next = ch->ch_epg_next; htsmsg_add_u32(out, "eventId", now ? now->id : 0); htsmsg_add_u32(out, "nextEventId", next ? next->id : 0); @@ -1198,7 +1197,7 @@ htsp_method_async(htsp_connection_t *htsp, htsmsg_t *in) if (epg) { CHANNEL_FOREACH(ch) { if (!htsp_user_access_channel(htsp, ch)) continue; - RB_FOREACH(ebc, channel_epg_schedule(ch), sched_link) { + RB_FOREACH(ebc, &ch->ch_epg_schedule, sched_link) { if (epgMaxTime && ebc->start > epgMaxTime) break; htsmsg_t *e = htsp_build_event(ebc, "eventAdd", lang, lastUpdate, htsp); if (e) htsp_send_message(htsp, e, NULL); @@ -1286,7 +1285,6 @@ htsp_method_getEvents(htsp_connection_t *htsp, htsmsg_t *in) /* Use event as starting point */ if (e || ch) { - ch = channel_epg_parent(ch) ?: ch; if (!e) e = ch->ch_epg_now ?: ch->ch_epg_next; /* Output */ @@ -1304,7 +1302,7 @@ htsp_method_getEvents(htsp_connection_t *htsp, htsmsg_t *in) events = htsmsg_create_list(); CHANNEL_FOREACH(ch) { int num = numFollowing; - RB_FOREACH(e, channel_epg_schedule(ch), sched_link) { + RB_FOREACH(e, &ch->ch_epg_schedule, sched_link) { if (maxTime && e->start > maxTime) break; htsmsg_add_msg(events, NULL, htsp_build_event(e, NULL, lang, 0, htsp)); if (num == 1) break;