From: E.Smith <31170571+azlm8t@users.noreply.github.com> Date: Mon, 17 Sep 2018 19:10:01 +0000 (+0100) Subject: dvr: Make timeslot scheduling configurable. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b9dfe82fc85550990249689abf67fa83fc39506b;p=thirdparty%2Ftvheadend.git dvr: Make timeslot scheduling configurable. The configuration to enable finding a 'best' time slot for recording is now configurable as an advanced option in Configuration->Recording->DVR Profiles, with the default being disabled. When toggled, the autorec rules themselves need to be manually toggled to cause them to reschedule. --- diff --git a/src/dvr/dvr.h b/src/dvr/dvr.h index 398e7061c..596c9845b 100644 --- a/src/dvr/dvr.h +++ b/src/dvr/dvr.h @@ -76,6 +76,7 @@ typedef struct dvr_config { char *dvr_storage; int dvr_pri; int dvr_clone; + int dvr_complex_scheduling; uint32_t dvr_rerecord_errors; uint32_t dvr_retention_days; uint32_t dvr_removal_days; diff --git a/src/dvr/dvr_config.c b/src/dvr/dvr_config.c index f00cf97af..40ea62401 100644 --- a/src/dvr/dvr_config.c +++ b/src/dvr/dvr_config.c @@ -972,6 +972,23 @@ const idclass_t dvr_config_class = { .opts = PO_ADVANCED, .group = 1, }, + { + .type = PT_BOOL, + .id = "complex-scheduling", + .name = N_("For autorecs, attempt to find better time slots"), + .desc = N_("When scheduling an autorec, this option attempts " + "to schedule at the earliest time and on the 'best' " + "channel (such as channel with the most failover services). " + "This is useful when multiple timeshift " + "and repeat channels are available. Without this option " + "autorecs may get scheduled on timeshift channels " + "instead of on primary channels. " + "This scheduling " + "requires extra overhead so is disabled by default."), + .off = offsetof(dvr_config_t, dvr_complex_scheduling), + .opts = PO_ADVANCED, + .group = 1, + }, { .type = PT_STR, .id = "comment", diff --git a/src/dvr/dvr_db.c b/src/dvr/dvr_db.c index 8ceed8563..8b05e5fc1 100644 --- a/src/dvr/dvr_db.c +++ b/src/dvr/dvr_db.c @@ -1809,7 +1809,14 @@ dvr_entry_create_by_autorec(int enabled, epg_broadcast_t *e, dvr_autorec_entry_t LIST_FOREACH(de, &dvrentries, de_global_link) { if (de->de_bcast == e || epg_episode_match(de->de_bcast, e)) if (strcmp(dae->dae_owner ?: "", de->de_owner ?: "") == 0) { - /* See if our new broadcast is better than our existing schedule */ + /* See if our new broadcast is better than our existing schedule, + * but only if user want this overhead. + */ + if (!dae->dae_config || !dae->dae_config->dvr_profile) + return; + + if (!dae->dae_config->dvr_complex_scheduling) + return; /* Our autorec can never be better than a manually scheduled programme * since user might schedule to avoid conflicts.