]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
epg: ignore broadcast more early (limited EPG days)
authorJaroslav Kysela <perex@perex.cz>
Wed, 21 Feb 2018 18:10:28 +0000 (19:10 +0100)
committerJaroslav Kysela <perex@perex.cz>
Wed, 21 Feb 2018 18:10:28 +0000 (19:10 +0100)
src/epg.c
src/epg.h
src/epggrab/module/eit.c
src/epggrab/module/opentv.c
src/epggrab/module/psip.c
src/epggrab/module/xmltv.c

index fd05ecfa95e9bee00cad3840dd1013d5ce7c7770..7b5860333f7d6e72835e222953327318bbca0f45 100644 (file)
--- a/src/epg.c
+++ b/src/epg.c
@@ -467,6 +467,13 @@ int epg_episode_number_cmpfull ( const epg_episode_num_t *a, const epg_episode_n
  * Channel
  * *************************************************************************/
 
+int epg_channel_ignore_broadcast(channel_t *ch, time_t start)
+{
+  if (ch->ch_epg_limit && start < gclk() + ch->ch_epg_limit * 3600 * 24)
+    return 1;
+  return 0;
+}
+
 static void _epg_channel_rem_broadcast 
   ( channel_t *ch, epg_broadcast_t *ebc, epg_broadcast_t *ebc_new )
 {
@@ -566,9 +573,6 @@ 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;
 
index 1c675247abc5233edbe4cb064dec01f94c2ea351..ba53c6c9594351d09c6106675694dc0bb5c1936e 100644 (file)
--- a/src/epg.h
+++ b/src/epg.h
@@ -458,6 +458,7 @@ epg_broadcast_t *epg_broadcast_deserialize
  * Channel - provides mapping from EPG channels to real channels
  * ***********************************************************************/
 
+int epg_channel_ignore_broadcast( struct channel *ch, time_t start );
 /* Unlink */
 void epg_channel_unlink ( struct channel *ch );
 /* Match now / next events */
index b23ec23b8461ed5da36625ddda01d9a843ed7195..6248031be7788eecb80f37f9ae1b8480fe51aadb 100644 (file)
@@ -622,6 +622,9 @@ static int _eit_process_event_one
                   bcdtoint(ptr[9] & 0xff);
   running = (ptr[10] >> 5) & 0x07;
 
+  if (epg_channel_ignore_broadcast(ch, start))
+    return 0;
+
   /* Find broadcast */
   ebc  = epg_broadcast_find_by_time(ch, mod, start, stop, 1, &save2, &changes);
   tvhtrace(LS_TBL_EIT, "svc='%s', ch='%s', eid=%5d, tbl=%02x, running=%d, start=%s,"
index 42cd25be4110f59e7a69975ddd0eab5ae2699081..ad573df3ce85dcea1dcc5f3bede477ba3fd66806 100644 (file)
@@ -310,6 +310,9 @@ opentv_parse_event_section_one
      * Broadcast
      */
 
+    if (epg_channel_ignore_broadcast(ch, ev.start))
+      goto done;
+
     merge = changes = 0;
 
     /* Find broadcast */
index 759b7f4cff72e82bc4ca281f3f54dc6b3118d44a..9a6ba041fae7923a22438a6ec12fabf451c87610 100644 (file)
@@ -376,6 +376,9 @@ _psip_eit_callback_channel
 
     if (size > len) break;
 
+    if (epg_channel_ignore_broadcast(ch, start))
+       goto next;
+
     title = atsc_get_string(ptr+10, titlelen);
     if (title == NULL) continue;
 
index 7b830cc640fa3cf751ca1c807feed00f446f2116..5c7bb28774fa93f2bdf2e0b421d32cd2376a5bf9 100644 (file)
@@ -622,6 +622,9 @@ static int _xmltv_parse_programme_tags
   time_t first_aired = 0;
   int8_t bw = -1;
 
+  if (epg_channel_ignore_broadcast(ch, start))
+    return 0;
+
   memset(&epnum, 0, sizeof(epnum));
 
   /*