From: Jaroslav Kysela Date: Mon, 19 Feb 2018 09:04:36 +0000 (+0100) Subject: channel: Add EPG limit, fixes #4935 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1bfcb7221b591ffffa904ea3d21d35dfb8aceed0;p=thirdparty%2Ftvheadend.git channel: Add EPG limit, fixes #4935 --- diff --git a/src/channels.c b/src/channels.c index baf8d1f5c..0209f3b6d 100644 --- a/src/channels.c +++ b/src/channels.c @@ -478,6 +478,17 @@ const idclass_t channel_class = { .off = offsetof(channel_t, ch_epgauto), .opts = PO_ADVANCED, }, + { + .type = PT_U32, + .id = "epglimit", + .name = N_("Limit EPG (days)"), + .desc = N_("Limit EPG data to specified days to reduce " + "the memory consumption. The zero value means " + "unlimited EPG."), + .def.i = 1, + .off = offsetof(channel_t, ch_epg_limit), + .opts = PO_ADVANCED, + }, { .type = PT_STR, .islist = 1, diff --git a/src/channels.h b/src/channels.h index 12a9bfb6c..5d95ee4af 100644 --- a/src/channels.h +++ b/src/channels.h @@ -73,6 +73,7 @@ typedef struct channel gtimer_t ch_epg_timer; gtimer_t ch_epg_timer_head; gtimer_t ch_epg_timer_current; + uint32_t ch_epg_limit; int ch_epgauto; idnode_list_head_t ch_epggrab; /* 1 = epggrab channel, 2 = channel */ diff --git a/src/epg.c b/src/epg.c index 348452abf..6b92da45a 100644 --- a/src/epg.c +++ b/src/epg.c @@ -563,6 +563,9 @@ static epg_broadcast_t *_epg_channel_add_broadcast return NULL; } + if (ch->ch_epg_limit && (*bcast)->start < gclk() + ch->ch_epg_limit * 3600 * 24) + return NULL; + /* Set channel */ (*bcast)->channel = ch;