]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
channel: Add EPG limit, fixes #4935
authorJaroslav Kysela <perex@perex.cz>
Mon, 19 Feb 2018 09:04:36 +0000 (10:04 +0100)
committerJaroslav Kysela <perex@perex.cz>
Mon, 19 Feb 2018 09:04:36 +0000 (10:04 +0100)
src/channels.c
src/channels.h
src/epg.c

index baf8d1f5c153e5045838ea24298edcd1095a7cec..0209f3b6d4964732d3110662398558695bc144fd 100644 (file)
@@ -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,
index 12a9bfb6cbec6fdd8eb34cfa463413e3e17dbce6..5d95ee4af3fbae28487034bbb8b075019cc410cd 100644 (file)
@@ -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 */
index 348452abf3b0e455f6950e47df91495d870f5e11..6b92da45a8f83d3d3e981ad1e33276f7fcd2823b 100644 (file)
--- 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;