]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
dvr: Make timeslot scheduling configurable.
authorE.Smith <31170571+azlm8t@users.noreply.github.com>
Mon, 17 Sep 2018 19:10:01 +0000 (20:10 +0100)
committerJaroslav Kysela <perex@perex.cz>
Thu, 20 Sep 2018 12:28:36 +0000 (14:28 +0200)
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.

src/dvr/dvr.h
src/dvr/dvr_config.c
src/dvr/dvr_db.c

index 398e7061c56c92c15ff8f05c6952c0c207c0c386..596c9845bffa3c438fcfee4425e839179520c332 100644 (file)
@@ -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;
index f00cf97af8144d696677e98e12ffe89bd8d34460..40ea624018c3ddfdd1cfce7ace53eb18191a3e69 100644 (file)
@@ -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",
index 8ceed85632f178dfe0127a16ba61525ac7cdac21..8b05e5fc10e2ad88b057eb95be57b0facc5fff11 100644 (file)
@@ -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.