From 9c168621f068d1b58248a965388fc0f1877b0173 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Wed, 21 Feb 2018 19:10:28 +0100 Subject: [PATCH] epg: ignore broadcast more early (limited EPG days) --- src/epg.c | 10 +++++++--- src/epg.h | 1 + src/epggrab/module/eit.c | 3 +++ src/epggrab/module/opentv.c | 3 +++ src/epggrab/module/psip.c | 3 +++ src/epggrab/module/xmltv.c | 3 +++ 6 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/epg.c b/src/epg.c index fd05ecfa9..7b5860333 100644 --- 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; diff --git a/src/epg.h b/src/epg.h index 1c675247a..ba53c6c95 100644 --- 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 */ diff --git a/src/epggrab/module/eit.c b/src/epggrab/module/eit.c index b23ec23b8..6248031be 100644 --- a/src/epggrab/module/eit.c +++ b/src/epggrab/module/eit.c @@ -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," diff --git a/src/epggrab/module/opentv.c b/src/epggrab/module/opentv.c index 42cd25be4..ad573df3c 100644 --- a/src/epggrab/module/opentv.c +++ b/src/epggrab/module/opentv.c @@ -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 */ diff --git a/src/epggrab/module/psip.c b/src/epggrab/module/psip.c index 759b7f4cf..9a6ba041f 100644 --- a/src/epggrab/module/psip.c +++ b/src/epggrab/module/psip.c @@ -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; diff --git a/src/epggrab/module/xmltv.c b/src/epggrab/module/xmltv.c index 7b830cc64..5c7bb2877 100644 --- a/src/epggrab/module/xmltv.c +++ b/src/epggrab/module/xmltv.c @@ -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)); /* -- 2.47.3