config.dscp = -1;
config.descrambler_buffer = 9000;
config.epg_compress = 1;
+ config.epg_cutwindow = 5*60;
config_scanfile_ok = 0;
config.theme_ui = strdup("blue");
.off = offsetof(config_t, epg_compress),
.opts = PO_EXPERT,
.def.i = 1,
- .group = 1
+ .group = 2
},
#endif
+ {
+ .type = PT_U32,
+ .id = "epg_cutwindow",
+ .name = N_("EPG overlap cut"),
+ .desc = N_("The time window to cut the stop time from the overlapped event in seconds."),
+ .off = offsetof(config_t, epg_cutwindow),
+ .opts = PO_EXPERT,
+ .group = 2
+ },
{
.type = PT_STR,
.islist = 1,
#include <time.h>
#include "tvheadend.h"
+#include "config.h"
#include "queue.h"
#include "channels.h"
#include "settings.h"
_epg_channel_rem_broadcast(ch, ret, NULL);
return NULL;
}
+ if (config.epg_cutwindow && ebc->stop - ebc->start > config.epg_cutwindow * 2 &&
+ ebc->stop - ret->start <= config.epg_cutwindow) {
+ tvhtrace(LS_EPG, "cut stop for overlap (b) event %u (%s) on %s @ %s to %s",
+ ebc->id, epg_broadcast_get_title(ebc, NULL),
+ channel_get_name(ch),
+ gmtime2local(ebc->start, tm1, sizeof(tm1)),
+ gmtime2local(ebc->stop, tm2, sizeof(tm2)));
+ ebc->stop = ret->start;
+ _epg_object_set_updated(ebc);
+ continue;
+ }
tvhtrace(LS_EPG, "remove overlap (b) event %u (%s) on %s @ %s to %s",
ebc->id, epg_broadcast_get_title(ebc, NULL),
channel_get_name(ch),
_epg_channel_rem_broadcast(ch, ret, NULL);
return NULL;
}
+ if (config.epg_cutwindow && ret->stop - ret->start > config.epg_cutwindow * 2 &&
+ ret->stop - ebc->start <= config.epg_cutwindow) {
+ tvhtrace(LS_EPG, "cut stop for overlap (a) event %u (%s) on %s @ %s to %s",
+ ebc->id, epg_broadcast_get_title(ebc, NULL),
+ channel_get_name(ch),
+ gmtime2local(ebc->start, tm1, sizeof(tm1)),
+ gmtime2local(ebc->stop, tm2, sizeof(tm2)));
+ ret->stop = ebc->start;
+ _epg_object_set_updated(ebc);
+ continue;
+ }
tvhtrace(LS_EPG, "remove overlap (a) event %u (%s) on %s @ %s to %s",
ebc->id, epg_broadcast_get_title(ebc, NULL),
channel_get_name(ch),