Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Revert "channel: add possibility to reuse EPG from another channel, f…
…ixes #3217"

This reverts commit 3ba8ec1.

It does not work as expected. The EPG data must be duplicated in database.
  • Loading branch information
perexg committed Oct 29, 2015
1 parent 9d28df5 commit eb13bbf
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 50 deletions.
22 changes: 0 additions & 22 deletions src/channels.c
Expand Up @@ -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
},
{}
}
};
Expand Down Expand Up @@ -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 )
{
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down
19 changes: 1 addition & 18 deletions src/channels.h
Expand Up @@ -61,15 +61,14 @@ 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;
gtimer_t ch_epg_timer;
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 */
Expand Down Expand Up @@ -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 */
2 changes: 1 addition & 1 deletion src/dvr/dvr_autorec.c
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions src/dvr/dvr_db.c
Expand Up @@ -942,7 +942,7 @@ dvr_entry_rerecord(dvr_entry_t *de)

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))
Expand Down Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/epg.c
Expand Up @@ -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);
}
Expand Down
10 changes: 4 additions & 6 deletions src/htsp_server.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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 */
Expand All @@ -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;
Expand Down

0 comments on commit eb13bbf

Please sign in to comment.